In his first interview after winning the presidency, Donald Trump hinted that he will shift policy in the Syria conflict from one of support for the moderate opposition to collaboration with the regime of President Bashar al-Assad. “Syria is fighting ISIS, and you have to get rid of ISIS,” Trump said. As for the rebels that the U.S. has backed fitfully for the past three years, he said: “We have no idea who these people are.”

But the president-elect appears to be ill-informed about Assad’s key role in the rise of the so-called Islamic State.

This three-part series documents the Syrian dictator's sinister contributions to this tale of terrorism and horror. First, he tried to ingratiate himself with Western leaders by portraying the national uprising against him as a terrorist-led revolt. When that failed, he released jailed Islamic extremists who’d fought against U.S. troops in Iraq, then staged phony attacks on government facilities, which he blamed on terrorists. Far from fighting ISIS, Assad looked the other way when it set up a state-within-a-state with its capital in Raqqa, and left it to the U.S. and others to counter the Islamic extremists.

ISTANBUL—After spending a month in an Aleppo prison at the start of the Syrian uprising, political activist Abdullah Hakawati thought he knew what to expect when Bashar al-Assad’s military intelligence arrested him for a second time in September 2011.

He was hanged by his hands for four days. They beat him with clubs and iron bars, and used electric prods on his genitals, he says. Then came the surprise: After a staged trial and a conviction for terrorism, he was sentenced to a lockup where his cellmates were hardcore al Qaeda veterans, newly transferred from Syria’s political prisons.

“It was the first time I saw someone from the al Qaeda movement face to face,” said Hakawati, an actor who’d played the lead role in an anti-regime play that spring and had helped organize demonstrations in Aleppo, Syria’s biggest city. “They threatened to slaughter me because I’m an atheist and I do not pray.”

After weeks in the same cell with the al Qaeda veterans, who were “practically the managers of the prison,” five of Hakawati’s colleagues joined the extremists, many later taking up arms against Assad.

Mixing civic activists with al Qaeda veterans was no accident.

The Syrian president had alleged that armed terrorists had led the national uprising in 2011, which seemed preposterous at the time. So Assad used his security apparatus to make the reality match his propaganda. Claiming to be the victim of extremism, he in fact played the principal enabling role in its rise in the region, a two-year investigation by The Daily Beast shows. The scene at Aleppo Central Prison was part of a concerted effort to radicalize and discredit the nationwide revolt.

As President-elect Donald Trump weighs closer military cooperation with the Assad regime in fighting ISIS, the story of Assad’s role in the rise of the so-called Islamic State could come home to haunt him. Critics say that any U.S. collaboration with Assad or his Russian protectors will backfire, leaving the Syrian leader in power as he continues to play his long-running double game with terrorists.

John Kerry, the outgoing secretary of state, said in November 2015 that ISIS “was created by Assad” and by former Iraqi Prime Minister Nouri al-Maliki, both of whom released al Qaeda prisoners in their respective countries. Assad’s aim was to tell the world, “It’s me or the terrorists.”

This series charts Assad’s major role in the rise of Islamic extremism from the inside. Based on exclusive interviews with high-level defectors from the regime’s security apparatus, it sheds new light on key decisions—like sending volunteers to fight the U.S. occupation of Iraq, which helped establish the forerunner of the Islamic State, releasing more than 1,000 former al Qaeda militants from Syrian prisons in 2011, and rarely fighting the Islamic State militants.

It also reveals how:

— the regime likely staged bombings of its own security facilities in 2011 and 2012 to foster the impression that al Qaeda had an armed presence in Syria long before it did.

— Syrian intelligence received orders to stand by when al Qaeda fighters crossed from Iraq into Syria in 2012.

— Syrian intelligence has penetrated the leadership of extremist jihadist groups and at critical moments can influence their operations.

Remarkably, several high-level former Syrian security officials who spoke on the record with this reporter said that U.S. intelligence agencies never debriefed them. The ex-officials viewed this as a major lapse, not only because they were privy to, and complicit in, the inner workings of Assad’s role in organizing a terrorist insurgency against U.S. forces in Iraq, but also because they were well-placed to advise on the establishment of a new state security apparatus should Assad’s police state collapse or be overthrown.

The Obama administration apparently wasn’t interested. A former top U.S. diplomat said the CIA had little interest in Syrian defectors and debriefed them only if the diplomat insisted.

The CIA declined to comment but did not dispute the validity of the question. “I looked into this, and there is nothing we can add,” a spokeswoman said.

***

Assad’s relations with the jihadists traces back to the seminal role his regime played in helping foment the Iraqi insurgency following the U.S. invasion in 2003.

A trove of al Qaeda personnel records uncovered by U.S. forces in 2007 in the northern Iraqi town of Sinjar showed that more than 600 fighters from Saudi Arabia, Libya, and other Muslim countries had crossed into Iraq from Syria between August 2006 and August 2007. “It is almost inconceivable that Syrian intelligence has not tried to penetrate these networks,” a report by the West Point Combating Terrorism Center (PDF) stated in 2008.

Internal State Department cables released by WikiLeaks confirm that the U.S. had intelligence showing that almost all foreign al Qaeda volunteers entered Iraq via Syria and that Assad and his top aides were fully aware. In 2010, they acknowledged as much to visiting U.S. officials, a WikiLeaks cable showed. “In principle, we don’t attack or kill them immediately,” Gen. Ali Mamluk, now Assad’s top intelligence advisor, said of al Qaeda operatives. “Instead, we embed ourselves in them, and only at the opportune moment do we move.” Mamluk offered cooperation in arresting terrorists in exchange if the U.S. would ease economic and travel sanctions.

But that’s only the half of it. Defected Syrian intelligence officials and former volunteers said the regime encouraged Syrians to volunteer for the anti-American jihadist, and thousands did.

“Syria wanted to prolong the Iraq war and the attacks on U.S. forces, so that the Americans couldn’t come into Syria,” said Anas al-Rajab, a former Islamist from Hama province who fought in Iraq and then, on returning to Syria, served two brief terms in prisons run by the Syrian mukhabarat, or intelligence services.

Mahmud al-Naser, a defected Syrian intelligence officer interviewed for this series, said the mukhabarat estimated 20,000 people crossed into Iraq as the U.S. began its attack in March 2003, but most returned immediately after the fall of Baghdad three weeks later.

But another 5,000 crossed for reasons of religious ideology—and they “are what gave birth to the monster” that now dominates much of Iraq and Syria, said Naser, the former head of political party affairs at the Syrian intelligence station in Ra’s al Ein, in northern Syria.

Naser now works with Syrian émigré lawyers in a major city in southern Turkey collecting data on alleged regime war crimes. Following an introduction by those lawyers, Naser sat down for seven hours of questioning over three sessions this past spring.

Like other security defectors interviewed for this series, several of whom were at general officer rank, Naser said U.S. intelligence had never debriefed him.

“We in Syria intelligence opened all the doors for [the jihadists] to go to Iraq,” he said.

That view is widely held in the region.

“The Syrian government made an enormous mistake in 2003,” said Massoud Barzani, the president of the Kurdistan Regional Government in a recent interview with The Daily Beast at his military headquarters in Suheil, in the far north of Iraq’s Kurdistan region, near the Syrian and Turkish borders. “They opened the door to terrorists in order to put pressure on the American troops in Iraq so they wouldn’t even think of war (against Syria).”

The regime has “of course a very great responsibility” for what has occurred. “Out of that came al Qaeda in Iraq, then Daesh, and the extremists who have spread around Syria. That is the result today.” (Daesh is the Arabic pejorative term for ISIS.)

Volunteers joined the battle knowingly.

Many underwent training and indoctrination, overseen by the Syrian intelligence services, before their departure. One of the best-known figures in the indoctrination operation was Mahmud al-Aghasi, known as Abu al-Qaqa’a, a Muslim cleric in Aleppo, whose al Tawabbin mosque was a recruiting center for Salafists heading to Iraq.

The cleric would stage marches from his mosque to the city center and lead the chant: “We are going to slaughter the Americans,” said Bassam Barabandi, a former Syrian diplomat who now lives in Washington.

“He would give guarantees that foreign fighters would have no problems if they came,” Barabandi said. It was clear he had a top-level sponsor. “He could not function in a police state like Syria without very high-level approval,” he said.”

Barabandi also was never asked for his insights. ”Nobody ever debriefed me,” he told The Daily Beast. “I took the initiative and contacted friends at the State Department, and we had a lunch or dinner. That was it.”

In fact, Syrian intelligence had recruited imams as agents during their study of Sharia at university facilities.

“We commissioned some of the imams who work for Syrian intelligence. Abu al-Qaqa’a was only one of dozens,” said Naser.

Raed Ilawy, an Islamist recruit from Hama, was among the Syrians who traveled to the mosque. Some of the trainers, he recalled in an interview at an Istanbul café, came from Assad’s intelligence services, and some accompanied them to the Iraqi border in what the recruits called “Bashar Assad caravans.”

The Syrian government was kept informed throughout, said Awad al-Ali, a former general in Assad’s police apparatus. Abu al-Qaqa’a, who was assassinated in 2007, possibly by the mukhabarat, also provided Assad’s intelligence services with lists of names of those who’d been trained.

Syrian intelligence “kept a census” of those who left, because on their return, “everyone would be followed” by the Department of Religious Intelligence in the Management of General Intelligence, one of Assad’s numerous spying agencies, said Naser.

About one quarter never came back, either joining al Qaeda in Iraq or dying in battle, he said. Of those who returned, about 1,500 were viewed as Islamists arrested as arrested on terrorism-related charges.

***

Sednaya, north of Damascus, is Syria’s most notorious political prison. Diab Serriya, a civic activist who served five years in Sednaya, and was released in 2011, said the number of Islamic fundamentalists imprisoned with him rose from about 300 when he arrived in 2006 to some 900 when he was released. Almost all had seen time fighting in Iraq against the American occupation, almost all were Salafist-jihadists, or hardline violent Islamists, and most were sentenced from five to 15 years for terrorist activities or association with terror groups, he said. Serriya was interviewed in late 2014 after delivering a speech about his experiences before a Syrian cultural club in Istanbul.

Sednaya was not a site for correction and rehabilitation but functioned as an incubator for jihadism, according to former prisoners and intelligence defectors. Some former detainees called it a “five star” prison.

According to former intelligence officials and prisoners, detainees were sorted according to their ideology. Two cellblocks were reserved for the most extreme Islamists, many of whom are now in leadership positions in ISIS. Two were reserved for less extreme Islamists, many of whom are now in the al Qaeda affiliate formerly known as Jabhat al Nusra, and three for more moderate Islamists, many of whom wound up in another prominent Syrian Islamist faction known as Ahrar al Sham. The other three were occupied by moderate Islamists and “democrats” such as Serriya.

The religious fundamentalists organized as if in a caliphate, with groups pledging loyalty to emirs, just as extremist Islamist groups do today, he said.

They wrote slogans on the walls, setting out their goals upon their release, Serriya said. “Some even had the illusion that upon their release, they would go straight to Damascus and establish a caliphate there,” he said.

When the Syrian uprising began in mid-March 2011, Assad began releasing religious extremists from Sednaya.

The regime said it was a response to activists’ demands to free political prisoners. U.S. intelligence officials, who spoke on background, offer a similar explanation. But sending known al Qaeda extremists into a country seething with unrest was also a cynical ploy to use extremists to further his political ends, according to Naser.

“The reason the regime released them at the beginning of the Syrian revolution was to complete the militarization of the uprising,” said Naser, who defected in late 2012, “and to spur criminal acts so that revolution would become a criminal case and give the impression that the regime is fighting terrorists.”

Syrian intelligence formed links in prison with the extremists, allowing them closely to track their rise in the rebel movement, according to Serriya, al-Ali, and former intelligence officials. “Every extremist group is penetrated by the regime,” Serriya said.

The regime not only had penetrated the networks but often ran them. That was by design. As Gen. Ali Mamluk told U.S. officials in 2010, the regime as a practice would “embed ourselves” among Islamic extremists in order to turn on them later. Mamluk is currently Assad’s senior intelligence adviser.

Nabeel Dendal, former director of political intelligence in Latakia, the Assad family’s ancestral home, said he twice led security forces in raids on al Qaeda cells, only to learn that the cell leader he was working for was supported by the Syrian intelligence.

“They were preparing them to be leaders,” the defected colonel said, referring to the Assad regime. An example is Nadim Baloush, an al Qaeda cell leader he arrested in Latakia in 2006, and told him “don’t do anything. I am working for Assef Shawkat,” Assad’s brother-in-law who served as the deputy defense minister. Baloush was arrested after he traveled to Turkey about a year ago and is reported to have committed suicide in prison.

Dendal was introduced to this reporter by a former regime judge from Aleppo who deserted to the opposition. Interviewed in a café in Istanbul’s popular Fatih district, which is now packed with Syrian refugees, he estimated that half the commanders in ISIS are working with the regime today; other defectors from the security sector say it’s about one third. According to Naser, most of the top commanders of Daesh in Raqqa are linked with Syrian intelligence.

Certainly in Aleppo’s Central Prison, the extremists had a “very smooth” relationship with their guards, in contrast with the civil prisoners, who had no privileges at all, civil protester Abdullah Hakawati said.

There were six inmates from Sednaya, and others from other major political prisons, Tadmor (in the ancient city of Palmyra), the Palestine Branch and “291”—altogether 15 al Qaeda members in the cell at Aleppo Central Prison with 15 civic activists such as Hakawati.

The al Qaeda members had privileges, Hakawati remembers, including smartphones, access to the internet, freedom to grow beards and dress in the Afghan-style shalwar kameez, and to order carry-in meals. They held daily religious lessons and prayed for the health of al Qaeda leaders. Hakawati said that while in the prison, he heard “one complete speech by Bin Laden,” who’d been killed by U.S. forces a few months earlier.

If a civil activist ran afoul of the authorities, al Qaeda members stepped in to protect him.

“They were practically the managers of the prison,” Hakawati said. “It was a paradise for them.” And after several weeks with them, five of his colleagues joined the extremists.

Hakawati recounted the time that the prison warden, a general, sat with all the prisoners. “On that day, one of the al Qaeda prisoners, Mahmoud Manigani said to the general, ‘When I am released, on the second day, I will kill you.’” The general responded: “This is something only you can decide.”

But when a civic activist complained that the food was inadequate, the warden threatened: “Would you like me to play with your testicles?”

The relationship between the civic activists and the extremists could be hostile. Hakawati recalled that after a long philosophical discussion with Manigani about the meaning of God, the Islamist beat him up. But not every encounter was hostile. One jihadist thanked Hakawati for helping organize the popular uprising. “It’s due to your demonstrations that we are all comfortable now,” he said.

Former Sednaya prisoners took top positions in Islamist forces. For example, Abu Lukman, one of the founders of Syrian al Qaeda branch Jabhat al Nusra, is now the emir, or administrator, of Raqqa. Mahmoud al-Khalif, another Sednaya graduate, works in the security area and Haj Fadel al-Agal is responsible for social relations. One former prisoner, Abu Abdulrahman al-Hamwi, is the emir of Nusra in Hama province. Other leaders include Abu Naser Drusha, a cousin of Abu Muhammad al-Jolani, the founder and principal leader of Nusra, Abu Hussien Zeniah, now in charge of Nusra operations in Qalamoun area near Damascus, and Abu Hafs al-Kiswani, a Nusra commander in Dara’a, southern Syria.

A Sednaya “sheikh” heads the Syrian Islamic Front, an umbrella group for Islamist fighters not affiliated with al Qaeda, and others became leaders of lesser Islamist groups, including Zahran Alloush, who led the Islamist faction Jaysh al Islam until he was killed in a Russian airstrike last Christmas, and Ahmed Issa al-Sheikh, leader of another rebel group, Suqoor al Sham.

Hassan Abboud, who founded Ahrar al Sham, the largest Islamist fighting group in Syria, also served time at Sednaya and was released during the demonstrations. Abboud was killed along with most of Ahrar al Sham’s leadership in a mysterious explosion in September.

They rose rapidly to leadership positions, said al-Ali. Having spent time at Sednaya was the equivalent of a graduate degree with honors. “If someone is a ‘graduate’ of Sednaya, he is indisputably a ‘Sheikh,’” he said. “People will say ‘he paid a high price’ serving in Sednaya.”

Syria’s intelligence apparatus was the big winner. With intimate knowledge of all the ex-detainees, it had a file on every one of them and was positioned to maintain its contacts with them.

Civil activists see those releases as part of Assad’s plan to ruin the revolution.

And it worked, activist Diab Serriya said. “The regime was very successful in distorting the image of the revolution,” said Serriya. “Now the battle is portrayed as being between the secular regime and extremist Islamic groups.”

—with additional reporting by Mousab Alhamadee