Presidential envoy Zalmay Khalilzad continues to advance his proposed peace deal with the Taliban despite increasing criticism inside Afghanistan that he is, in effect, empowering the Taliban, undercutting the elected government, and simply embracing the same formula and Taliban pledges that the Clinton administration accepted when it negotiated with the Taliban prior to the Sept. 11, 2001, terror attacks.

Such criticism came to a head earlier this month when Afghan national security adviser Hamdullah Mohib visited New York and Washington and criticized both Khalilzad’s imperious manner (a complaint Afghans share with Iraqis) and his efforts to cut the elected Afghan government out of the loop on the commitments he was making that would affect them (a complaint India shares with Afghanistan). The U.S. State Department (and Undersecretary of State David Hale , a former U.S. ambassador to Pakistan) was furious at Mohib’s remarks. They had tried to keep any criticism of Khalilzad’s dealing from reaching Congress, hence their decision to deny a U.S. visa to Amrullah Saleh, a former interior minister and head of Afghan intelligence.

Within Afghanistan, Hale and Khalilzad’s temper tantrum increasingly puts U.S. forces at risk and makes the United States look ridiculous. Tuesday, for example, U.S. diplomats walked out of a meeting with elected Afghan President Ashraf Ghani because they spotted his national security adviser in the room. So, for Khalilzad and the State Department, it’s okay to sit down with those who murdered thousands of U.S. forces in cold blood (and many times that number of Afghan partners), but it is not acceptable to be in the same room with a man who criticized such moral inconsistency? The tragedy of such exaggerated hypersensitivity is that it is the national security adviser who is a chief liaison with the U.S. military and intelligence community. Simply put, Khalilzad’s posturing could now get Americans killed.

The reverberations of Khalilzad’s deal, however, are now becoming clear with regard to Pakistan, the elephant in the room. Let’s call a spade a spade: Pakistan is a terror sponsor in all but formal designation . Without Pakistan, there would be no Taliban and no Afghan insurgency. Pakistan also has not paid the price for sheltering Osama bin Laden or for myriad terror attacks inside India.

Early in his presidency, President Trump signaled that he would no longer accept Pakistani duplicity. “The United States has foolishly given Pakistan more than 33 billion dollars in aid over the last 15 years, and they have given us nothing but lies & deceit, thinking of our leaders as fools,” he tweeted . Yet the Trump administration’s desire for peace at any price in Afghanistan and the State Department’s apparent embrace of Secretary of State John Kerry’s belief that a bad deal is better than no deal is empowering Pakistan beyond Islamabad’s wildest imagination.

Pakistan has used its leverage over the Taliban as an effective immunity card against any accountability for its actions. Beyond Trump’s tough words, Pakistan has not suffered any serious sanctions or cut-off in aid. To do so, Khalilzad and Hale argue behind the scenes, might undercut diplomacy with the Taliban. Now Pakistani leaders are upping their demands: Forget elections. Scrap the Afghan government and create an interim authority that would include the Taliban. Such demands by Pakistani Prime Minister Imran Khan have led Afghanistan to withdraw its ambassador to Pakistan. But they are also an acknowledgment by Pakistan that the Taliban do not have any meaningful electoral support.

No one wants perpetual war in Afghanistan, but it is important to acknowledge that U.S. forces have successfully prevented Afghanistan from being a launch pad for attacks against the United States. To empower Pakistan and the Taliban in the manner Khalilzad now does only ensures that this metric of success will be reversed. When President Ronald Reagan withdrew U.S. Marines from Beirut under fire, it only convinced Iran to increase its attacks against the United States and also inspired bin Laden to believe that he could use terrorism to send the United States fleeing.

Trump may want to end the war in Afghanistan. That’s a noble goal. But how wars end matters. Outright victory is the best outcome. That only could be possible if Pakistan did not continue to support, sponsor, and shelter the Taliban. Diplomatic outcomes involve compromise, but not all compromise is equal. The diplomatic spat with Mohib is a deliberate and dishonest distraction from what the Trump administration must know: To pursue the path Khalilzad appears to commit the United States to does nothing to bring peace, but rewards 17 years of terrorism.

Michael Rubin (@Mrubin1971) is a contributor to the Washington Examiner's Beltway Confidential blog. He is a resident scholar at the American Enterprise Institute and a former Pentagon official.