During his time in CIA custody, 9/11 mastermind Khalid Sheikh Mohammed told his interrogator something prophetic. The United States may enjoy some fleeting battlefield successes, Mohammed declared, but in the end "we will win because Americans don't realize ... we do not need to defeat you militarily; we only need to fight long enough for you to defeat yourself by quitting."

President Trump should ponder Mohammed's words as he prepares to withdraw U.S. forces from Syria — a move that will bring a smile to Mohammed's face.

Trump knows the consequences of suddenly withdrawing from a country. The Obama administration "created this huge vacuum" in Iraq in 2011, Trump correctly observed during the presidential debates, adding, "we should have never been in Iraq, but once we were there, we should have never gotten out the way they [did]." Once Trump was inaugurated, he changed former president Barack Obama's restrictive rules of engagement and freed up our military to drive the Islamic State from the territory it had seized. He deserves enormous credit for this achievement.

But just because the Islamic State controls no territory does not mean it is defeated. In 2011, the group controlled no territory in Iraq, yet thanks in no small part to Obama, it soon grew to establish a caliphate the size of Britain. Not only did the Islamic State revive itself, but the resurgent terrorist network also spread its murderous tentacles farther around the globe, establishing cells in 29 countries that have carried out 143 terrorist attacks that have killed 2,043 people and injured many thousands more. We are still living with the deadly consequences of Obama's catastrophic mistake. On Dec. 13, authorities in Bari, Italy, arrested a Somali man named Omar Moshin Ibrahim, believed to be a member of the Islamic State, who was threatening to bomb St. Peter's Basilica in Rome on Christmas Day.

Today, the Islamic State is much stronger than it was when Obama withdrew from Iraq in 2011. The Defense Department estimates that the Islamic State retains about 30,000 fighters in Iraq and Syria and is "more capable" than its predecessor group al-Qaeda in Iraq was at the latter's peak in 2006-2007. By contrast, when Obama pulled our troops out they had only about 700 fighters. According to the Institute for the Study of War, the Islamic State "was able to smuggle as much as $400 million out of Iraq and reinvest it into legitimate businesses across the wider Middle East." With the loss of its caliphate at Trump's hands, the Islamic State has gone back to its roots as a terrorist insurgency. It remains dangerous and well-funded and has global reach.

A U.S. withdrawal from Syria will not only remove the pressure on the Islamic State, it will create a vacuum in Syria that will be filled by the world's worst actors. ...

Trump was right to denounce Obama for declaring victory against the Islamic State and withdrawing U.S. forces. So why is he now doing exactly what he criticized Obama for doing? The president needs to ask himself: Who is celebrating this decision? Answer: Iran, Russia, the Assad regime, Hezbollah, the Islamic State — and, in his prison cell at Guantanamo Bay, Khalid Sheikh Mohammed.

When your enemies are cheering, you have made a mistake. It's not too late to change course.

Follow Marc A. Thiessen on Twitter, @marcthiessen.