Beto O'Rourke, former Texas congressman and current Democratic presidential candidate, is advancing the notion that President Trump might have hindered, not helped, the U.S.'s ability to take down ISIS leader Abu Bakr al-Baghdadi.

"Someone made the case, and it's very compelling to me, that this raid was successful in spite of or despite the president, not because of him," O'Rourke said on "The Daily Show" on Monday.

O'Rourke suggested that it was a "miracle" the U.S. was able to kill Al-Baghdadi after the president recently pulled U.S. troops out of northeastern Syria. Critics say that decision left Kurdish occupants, who've assisted the U.S. in containing ISIS in the region, vulnerable to an invasion from Turkey.

"To turn his back on those Kurdish fighters whose intelligence and help located al-Baghdadi in the first place and made sure that we were successful," O'Rourke said.

ISIS SPOKESMAN ABU HASSAN AL-MUHAJIR, POTENTIAL AL-BAGHDADI SUCCESSOR, ALSO KILLED IN SYRIA, OFFICIAL SAYS

"His precipitous withdrawal that created a void that Turkey and Russia, Iran and I.S.I.S. and Assad have all come in to -- it is really a miracle that we were able to do this but it is really owing to our allies, our friends, our partners on the ground and those great service members who put their lives on the line to ensure that there is justice for this country.”

O'Rourke was echoing criticism of Trump's decision -- namely, that he abandoned Kurdish allies and allowed Turkey's subsequent incursion into Syria.

CLICK HERE TO GET THE FOX NEWS APP

In a statement from the White House, Trump thanked Kurdish allies but also indicated his administration shared credit for the attack.

"Baghdadi has been on the run for many years, long before I took office. At my direction, as commander-in-chief, the United States obliterated his ‘caliphate’ in March of this year. Today’s events are another reminder that we will continue to pursue the remaining ISIS terrorists to their brutal end," he said.