Updated

The U.S. raid that killed Islamic State leader Abu Bakr al-Baghdadi was months in the making and involved significant intelligence from Kurdish allies in Syria – including a rare informant at the heart of ISIS who was in the compound at the time of the raid, Fox News has learned.

Gen. Mazloum Abdi, the Syrian Democratic Forces (SDF) commander, told Fox News how they tracked al-Baghdadi after the caliphate fell.

The general said the informant “told us that he moved west to Idlib, and to a specific house. We told American intelligence on May 15, and together set up a secret cell, which had three Americans in it.”

The SDF informant told them about the tunnels under the compound, how many people were with al-Baghdadi, and that he was planning to move, having been at that location for months. That’s when the U.S. carried out the attack at the compound Saturday, and brought out the informant safely.

Informants within ISIS are extremely rare. To have one so close to the leader is unheard of, and a remarkable achievement for Kurdish forces.

Mazloum said the raid could not have been possible without Kurdish intelligence.

PICTURED: MILITARY DOG THAT HELPED U.S. FORCES TAKE DOWN AL-BAGHDADI

Separately, a senior U.S. defense official described the SDF as a “key player” in the operation but noted the SDF and Kurds did not fly in with U.S. forces. The official said 11 children who were in the al-Baghdadi compound were “physically turned over to a trusted individual in the area.”

Mazloum also talked about the aftermath of President Trump's recent decision to pull troops from northeastern Syria -- a move critics say left Kurds who'd faithfully helped the U.S. contain ISIS vulnerable to a Turkish invasion.

“After the Americans pulled out, the Turks invaded, and we had no choice but to do a deal with the Syrian government and Russians. They were able to protect us. So, the Syrians moved to the border in place of the Americans.”

Fox News saw this, along with numerous cease-fire violations at the northern Syria front on Sunday. Syrian government forces took up their positions right opposite Turkish forces, which were just over half a mile away.

The Kurds said in the long run, they just couldn’t push back the Turkish Army themselves.

CLICK HERE TO GET THE FOX NEWS APP

Gun battles raged, and Turkish drone strikes and gunfire were regularly observed.

Mazloum also opened up about the future in Syria, saying it wasn’t too late for the U.S. to come back and protect the Kurds. “Our relationship with President Trump depends on him fulfilling his promise of protecting us.”

Fox News' Jennifer Griffin contributed to this report.