One of the key figures participating in the fight against the so-called Islamic State group in Iraq is a Shi’ite militant who less than a decade ago helped coordinate a brazen attack on U.S. troops that left five American soldiers dead.

Qais Khazali commands the Asa’ib Ahl al-Haq (AAH), “League of the Righteous,” an Iranian-funded Shi'ite militia, which, along with other Shi'ite militias, is playing a powerful role in helping turn the tide against the Islamic State group in Iraq.

One-time US Prisoner Now Key in Battling IS

His story illustrates the complex dynamic on the ground in the Middle East where a variety of forces are fighting for control of parts of Iraq and Syria and where traditional enemies find themselves fighting a common foe in the Islamic State group.

One-time US Prisoner Now Key in Battling IS

It highlights, too, some of the challenges facing the Obama administration and the West as to whom they align with in the battle against Islamic State militants.

One-time US Prisoner Now Key in Battling IS

Khazali was born in 1974 in the Shi'ite slum on the outskirts of Baghdad once known as Saddam City.

Like many disenfranchised young Shi’ites who bristled living under Iraqi leader Saddam Hussein, Khazali was attracted to the teachings of Shi'ite cleric and became one of the scholar’s leading students.

Sadr was gunned down by government forces in 1999 and Sadr’s son Muqtada assumed leadership of the movement.

After Baghdad fell in 2003, Muqtada formed the Mahdi Army and waged war on the U.S. coalition.

For a while, Khazali served as the group’s spokesman but ultimately broke away to form a militia of his own. AAH targeted coalition forces and Iraqi police with improvised explosive devices (IEDs), rockets, mortars and sniper fire and would .

One of the most spectacular occurred in when about a dozen AAH fighters attacked a government compound at Karbala, killing five U.S. soldiers.

The attackers wore American military uniforms and badges, carried American weapons and drove in black SUVs identical to those used by the U.S. military. The that only Iran could have orchestrated the operation.

Khazali was later captured and detained at the American prison known as Camp Cropper. He was extensively questioned by U.S. intelligence.

“He is the kind of person I could see myself, or others, following,” said Derek Harvey, a retired Army colonel and former intelligence adviser who spent hundreds of hours interviewing Khazali at Camp Cropper.

Harvey said they discussed many topics, including history, Islam, Shia politics, family and Iraqi nationalism, and described Khazali as “extremely thoughtful,” highly logical and possessing a “magnetic personality.”

“If he’s not trained [in logic], he’s a natural,” Harvey told VOA. “He’s the kind of person who can bring together different people, and he has tremendous purpose and drive and great ambition.”

From inside prison, Khazali continued to wield influence.

As detailed in a , Khazali ordered -- with a phone call from jail -- that attacks on American and British forces be halted. Harvey would not get into the specifics of his conversations with him but said Khazali “knew things that were going on in Baghdad before I did” -- even behind bars.

Khazali was released in late 2009 along with other AAH members in , though the U.S. and Britain have denied making any deal.

“When he came out of jail, he had more legitimacy,” said , an Iran research analyst at Foundation for Defense of Democracies, where he has tracked AAH’s rise.

In , Tehran called on its allies to help protect the Assad government, and AAH sent fighters into Syria. There, the militia was able to hone its fighting skills.

“I think sending our men to fight in Syria was the right decision," Khazali in 2014.

“Al-Qaida has had a lot of practice in street fighting. If our guys hadn’t gotten the experience in Syria, al-Qaida and ISIS could have taken Baghdad,” he said in the interview, using an acronym for the Islamic State group.

Today, AAH has grown to a 10,000-member force and is considered as one of the most powerful of the dozens of Shi’ite militias that operate in Iraq.

Analysts believe much of the group’s prowess is due to the training and money it receives from Iran -- as much as $2 million a month, according to .

The group’s main Iranian patron is thought to be Iranian general , commander of the Quds Force of the Iranian Revolutionary Guard Corps, a man the a terrorist.

in August 2014 and is currently in the battle to retake Tikrit.

U.S. General Martin E. Dempsey, the chairman of the Joint Chiefs of Staff, recently said the role of Shi’ite militias in reclaiming Tikrit might be “a positive thing.”