The Islamic Emirate of Afghanistan, the signature title of the Taliban, is rightly pleased with the agreement that it signed with the United States in Qatar on February 29. The agreement concedes their long-sought demand for the withdrawal “from Afghanistan of all military forces of the United States, its allies, and Coalition partners, including all non-diplomatic civilian personnel, private security contractors, trainers, advisors, and supporting services personnel within fourteen (14) months.” It is no wonder the Taliban is hailing the deal as a victory.

The United States secretary of defense has said that the Pentagon has already begun the first stage of the withdrawal of U.S. forces from 12,000 to 8,600. NATO, which was not even dignified with being named in the agreement, is also pulling out. The agreement categorically rules out any residual counterterrorism force or any training for the Afghan military. In short, it abandons the Afghan government’s military and puts the future of counterterrorism in the region in the hands of the Taliban and their Pakistani patrons.

It will be extremely difficult for the United States intelligence community to operate in this environment. The lack of any force protection even private contractors will inhibit the business of collecting information in dangerous territory. The challenge of knowing what is happening in the Afghanistan-Pakistan border region, long a hub of numerous terrorist organizations, will be acute.

The Taliban did not renounce al-Qaida in the agreement, or the 9/11 attacks. Its deputy commander Sirajuddin Haqqani didn’t do so either in his New York Times op-ed. Taliban propaganda has consistently extolled the 9/11 attacks as a victory for the global jihad, a narrative that it will argue is reinforced by the Doha agreement. “Jihad has defeated a superpower again,” the argument goes. The Doha agreement includes no statement about the human rights of Afghans, a glaring omission for Afghan women’s rights.

What the Taliban commits to is to prevent the use of Afghanistan’s territory for terrorist attacks on the United States and “its allies.” The Taliban will prevent training, fundraising, and other assistance for operations against the security of the U.S. and its allies. It’s a hortatory promise. It makes no mention of the Taliban infrastructure in Pakistan where numerous terrorists have long been based. It makes no mention of the Lashkar-e-Tayyiba terrorist network that cooperates with the Taliban and targets India.

The Taliban has already said that the seven-day reduction in violence that preceded the Doha agreement is over and that it is renewing attacks on Afghan targets. It made no promise of a comprehensive ceasefire, which is supposed to be negotiated in intra-Afghan talks that will supposedly begin on March 10 after a major prisoner exchange. The Afghan government has said it is not committed to the release of 5,000 Taliban prisoners in exchange for 1,000 Afghan government prisoners held by the Taliban, presumably in their bases in Pakistan. The Afghan government is hobbled by the outcome of last year’s elections, which has divided the government in two at this crucial juncture.

The fundamental flaw in this agreement is that the internationally recognized Afghan government, led by Ashraf Ghani, was not included in the negotiations. By accepting the Taliban demand to exclude the Afghan government, the Trump administration betrayed our ally and elevated the Taliban to our equal. It is worth remembering that at the height of their power in 2000, only three governments — Pakistan, Saudi Arabia, and the United Arab Emirates — recognized the Taliban as a legitimate government. Excluding the Afghan government is strikingly reminiscent of the Nixon administration’s deal with North Vietnam in 1973, which excluded the South Vietnam government.

Secretary of Defense Mark Esper has said that the administration will condition its compliance with the Doha agreement on the Taliban’s performance. That is to be hoped for. It’s unclear if the president is so committed. It is probably no accident that Secretary of State Mike Pompeo refrained from personally signing the deal.

The entire approach is only possible, ironically, because of the success of the Obama administration’s so-called AfPak strategy that aimed for the defeat of al-Qaida. With drones and commandos, the Obama administration hunted down Osama bin Laden and his lieutenants relentlessly in Pakistan. Yet bin Laden’s principal deputy, Ayman al-Zawahri, is still active in Pakistan. The agreement makes no commitment to his apprehension.

The Doha agreement is also a trap for any Democrat elected president in November. At his or her inauguration in January 2021, they will have to decide whether to adhere to the 14-month time frame for complete withdrawal from Afghanistan or to refuse the time line with three months to get the troops out and extend the “endless war,” a momentous decision.

Polling done by my Brookings colleague Shibley Telhami shows that a plurality of Americans do not want to cut and run from Afghanistan. A plurality also believes that the United States has a moral obligation not to abandon the Afghan people, especially Afghan women, to the dictatorship of the Taliban.

The United States has fumbled the war since its inception. In 2001, bin Laden and Zawahri were allowed to escape to Pakistan. Resources and attention were diverted from finishing the job in Afghanistan by the disastrous invasion of Iraq in 2003. Within five years, al-Qaida was more dangerous than ever before. Only the resolute decision of Barack Obama prevented another 9/11 attack. Don’t expect the Trump team to thank Obama.

Every American and Afghan is eager to see an end to the war. A political process is to be welcomed. Let’s hope the Doha agreement can be adjusted to get to a comprehensive ceasefire. It is not too late to insist on direct negotiations between Kabul and the Taliban as the prerequisite for future withdrawals of the international coalition in Afghanistan. A flawed deal is not going to deliver the security that a generation of American troops have fought for along with our partners. Let’s fix it.