A Taliban fighter patrols along a street in Kabul, Aug. 17.

Photo: wakil kohsar/Agence France-Presse/Getty Images

One of the most sweeping foreign-policy failures in American history has unfolded before our eyes. The Taliban has expanded its reign of terror, marching through provincial capitals and swallowing Afghanistan. The sad reality is that the Taliban is running the show and will surely provide a haven to a growing al Qaeda contingent. There is still time to help those who helped us and to limit the Taliban’s influence in Afghanistan, but we must act now.

After ensuring all American citizens are evacuated, the U.S. government’s priority should be ensuring the safety of the Afghans who helped our men and women operate in Afghanistan for 20 years. We believe most of those eligible for the Special Immigrant Visa program live outside Kabul; this reality must be addressed. There are thousands more who don’t qualify for the SIV program but who helped develop Afghan civil society and are equally at risk. Many worked as journalists or for nongovernmental and other democracy-building organizations. These individuals are under the same threat from the Taliban and could be subject to assassination owing to their affiliation with the U.S. government.

It must be made clear to the Taliban that we are committed to helping those who sacrificed for us and will ensure their safe evacuation. We must establish safe corridors not only in Kabul but throughout the country to move those who cannot make it to the capital. The Biden administration has sent two brigades of American forces into Afghanistan to secure the airport. We must not rush the withdrawal of those forces as the president rushed the withdrawal of troops, leading to the current catastrophe.

We urge the administration to extend the evacuation beyond their original target date of Aug. 31. President Biden must keep forces in place long enough to evacuate those to whom we owe a great debt. He must be willing to accept the risk that the Taliban will attack our forces. We cannot afford another disorderly race to the exit while we still have a chance to do right by those who risked their lives and their families’ lives fighting our common enemies. We should be willing to apply the full force of the U.S. military to this cause. Anything less would be dishonorable.

The U.S. also should discourage other nations from recognizing the Taliban as the legitimate government of Afghanistan. China and Iran, which border Afghanistan, have made clear they intend to work with the Taliban government. Recognition as the legitimate government of Afghanistan would give the Taliban access to economic aid and resources that won’t be used to improve the lives of normal Afghans. Instead, they will support those who wish to commit terrorism across the globe. This cannot happen. The Biden administration and our partner nations must be clear with China, Iran and other regional nations that recognition of the Taliban government will have severe consequences.

We can send a clear message by designating the Afghan Taliban a Foreign Terrorist Organization. The designation plays “a critical role in our fight against terrorism” and is “an effective means of curtailing support for terrorist activities,” according to the State Department. A recent United Nations report stated unequivocally that the “Taliban and Al-Qaida remain closely aligned and show no indication of breaking ties” and “Al-Qaida is resident in at least 15” Afghan provinces.

The Taliban has refused to renounce its relationship with al Qaeda. It has continued to let al Qaeda operate in areas under its control in violation of the agreement it made with the Trump administration. Al Qaeda’s leadership swears loyalty to the Taliban leader. And the Taliban has conducted countless attacks in Afghanistan against U.S. and partner forces, foreign civilians and Afghan civilians.

Another critical step to combat the Afghan Taliban is to limit their access to capital. Additional funds will result only in more bloodshed, more terror, more oppression of the Afghan people and more threats to Americans. The Taliban’s funding comes traditionally from criminal activity, including opium production, extortion and kidnapping for ransom. The fall of Afghanistan provides them with an opportunity for vast amounts of additional capital. The U.S. and the international community must do everything possible to freeze any assets and prevent funds from reaching the Taliban.

As the Taliban gains control of Afghanistan again, and the atrocities of their regime come to light, the U.S. must act. We cannot ignore the threat a Taliban government poses to our national security; doing so puts us at risk of another 9/11-type attack. We cannot rewrite the past but we have options to go forward. We must not miss this opportunity.

Mr. Graham, a Republican, is a U.S. senator from South Carolina. Mr. Keane, a retired general, was the Army’s vice chief of staff and is chairman of the Institute for the Study of War.

Wonder Land: Kabul’s conquerors hold the leverage in defining the terms of a postwar status quo. Images: AFP/Getty Images Composite: Mark Kelly The Wall Street Journal Interactive Edition