Imagine if, back in 2011, President Barack Obama had not only withdrawn all U.S. forces from Iraq, facilitating the rise of the Islamic State, but also invited Islamic State leaders to Camp David to sign an agreement cementing his withdrawal plan. Obama’s decision to pull out American troops was catastrophic, but even he was not dumb enough to seek a photo op with terrorists. Yet this is precisely what President Trump tried to do when he initially invited the Taliban to Camp David for a meeting this past weekend.

Here is the image that would have been broadcast across the Muslim world: Taliban leaders sitting at the very table where U.S. officials planned the overthrow of their regime, accepting what they would have portrayed as the terms of the United States’ surrender — right before the 18th anniversary of the 9/11 attacks. The propaganda victory for the Taliban would have been enormous, sending a message of U.S. weakness and emboldening terrorists across the world.

It gets worse. The Taliban team with whom the Trump administration has been negotiating includes five senior Taliban commanders — the “Taliban Five” — who were held at Guantanamo for 13 years before Obama freed them in exchange for U.S. Army deserter Sgt. Bowe Bergdahl. They include Mullah Fazel Mazloom, who according to his Guantanamo military file is “wanted by the UN for possible war crimes while serving as a Taliban Army Chief of Staff” and has “operational associations with significant al-Qaida and other extremist personnel.” They include Mullah Norullah Noori, “wanted by the UN for possible war crimes” and “associated with members of al-Qaida.” They include Abdul Haq Wasiq, Taliban deputy minister of intelligence who “utilized his office to support al-Qaida and to assist Taliban personnel elude capture … [and] arranged for al-Qaida personnel to train Taliban intelligence staff in intelligence methods” and “assigned al-Qaida members to the Taliban Ministry of Intelligence.” They include Mullah Khairullah Khairkhwa, who was “directly associated to [Osama bin Laden] and Taliban Supreme Commander Mullah Muhammad Omar.” And they include Mohammad Nabi Omari, “a senior Taliban official” who was “a member of a joint al-Qaida/Taliban [anti-coalition militia] cell in Khowst and was involved in attacks against U.S. and Coalition forces,” including one that killed two Americans.

These are murderous terrorists with American blood on their hands. It is an outrage that Obama freed them. But for Trump to even consider allowing leaders of a designated terrorist organization to set foot in Camp David is worse than an outrage; it is an insult to all those who died on 9/11 and the American troops who gave their lives fighting them in Afghanistan.

It was only the Taliban’s brutality — launching a suicide attack that killed an American service member on the eve of the Camp David summit — that prevented this debacle from unfolding. After the attack, Trump canceled the summit and tweeted, “What kind of people would kill so many in order to seemingly strengthen their bargaining position?” Terrorists, Mr. President — that’s who.

Trump’s defenders say this would have been no different from his diplomacy with Kim Jong Un, or his offer to meet with Iranian President Hassan Rouhani.

Yes, it is.

First, Kim and Rouhani are heads of government. Taliban leaders are terrorists. They claim to be the heads of a state — the “Islamic Emirate of Afghanistan.” Hosting them at Camp David grants them undeserved legitimacy.

Second, in the cases of North Korea and Iran, Trump is acting from a position of strength. He has imposed crippling sanctions on both regimes. With the Taliban, he’s negotiating from a position of weakness. He wants to get out of Afghanistan, and the Taliban knows it. A peace deal would not be a victory for the United States; it would be a victory for the Taliban.

The administration claims that the Taliban had agreed to break with al-Qaida and prevent them from reestablishing a haven in Afghanistan. The Taliban made the same promise in the 1990s, before 9/11. After the attacks, its leaders were given a choice: Break with al-Qaida, or lose your regime. They chose to lose their regime. The Taliban will never break with al-Qaida.

By killing an American soldier, Taliban leaders were rubbing the United States’ defeat in Trump’s face. That move backfired. Trump now says the Taliban talks “are dead.” Let’s hope so — and that with the death of those talks dies one of the most shameful moments of the Trump presidency.

Marc A. Thiessen writes a twice-weekly column for The Washington Post on foreign and domestic policy and contributes to the PostPartisan blog. He is a fellow at the American Enterprise Institute, and the former chief speechwriter for President George W. Bush.