MOSUL, Iraq — Iraq’s interior minister, Qassim al-Araji, has a troubled history with the United States. He was detained twice by the Americans at the notorious Camp Bucca prison during the Iraq war and held for 23 months, accused of smuggling Iranian-made bombs that had become effective killers of American troops.
As a former commander of an Iranian-backed militia, his loyalties are open to question. But when he met with the United States ambassador last year, he had a surprising message: He and other former Shiite militants wanted the Americans to stay. Iraq needed their help, he said, to stabilize the country and combat the threat of the Islamic State.
He even jokingly praised the superiority of American jails over Iraqi ones. “You have some things to teach us,” he told the American ambassador, Douglas J. Silliman.
The request represented a monumental switch for some of Iraq’s most influential Shiite leaders, and an opportunity for the United States to achieve its elusive security goals in the region, albeit with some unlikely partners.
But the evolving alliance means that the United States military is taking a risk: training, sharing intelligence and planning missions with former members of Iranian-backed militias that once fought and killed Americans.
Several former militia commanders have risen to high-level political positions. Now, a coalition of them is expected to be among the biggest winners in parliamentary elections this Saturday, giving them even more prominent roles in the new government and possibly determining the future of the American presence in Iraq.
The United States has expanded secretive military ventures and counterterrorism missions in remote corners of the world, but in Iraq it is taking a different tack. Here, the United States is reducing its troop presence and gambling that common interests with former adversaries will help prevent a resurgence of the Islamic State. The bet seemed to pay off with the announcement this week that a joint Iraqi-American intelligence sting captured five senior Islamic State leaders.
And as President Trump pursues a confrontational approach with Iran, the American military hopes to use its evolving Iraqi partnerships to peel away Shiite factions from Iran’s orbit and chip away at Tehran’s influence in Iraq and the region.
“This is a time when Iraqi patriots can build their nation,” said Lt. General Paul E. Funk II, the commander of the American-led coalition fighting the Islamic State in Iraq and Syria. “There is an opportunity here. We will do all we can to give them all the help they need and want.”
Last year, Congress appropriated $3.6 billion to train and equip Iraqi security forces, with a priority on units under Mr. Araji’s Interior Ministry. They include border guards monitoring the long Syrian-Iraqi frontier, a place where American and Iraqi commanders fear that Islamic State remnants could regroup, and which Iran sees as part of its corridor to move fighters and weapons to Syria and Lebanon. The funds also equip the Iraqi SWAT teams responsible for arresting and detaining terrorism suspects, and train a national police force in charge of daily security.
It was the Islamic State’s conquest of a third of Iraqi territory in 2014 that first brought together once-rival Iraqi militias and security forces with an American-led military coalition in a united effort to defeat a common enemy. The United States wanted to prevent the Islamic State from building a caliphate in Iraq and Syria, and the Shiite militias saw the Sunni extremist group as a sectarian threat.
After Iraq’s regular armed forces crumbled in the face of the Islamic State blitz, a coalition of Iranian-financed Shiite militias took up front-line positions against the extremists. The militias never worked directly with the Americans, but a joint command helped coordinate their efforts to defeat the Islamic State.
Now, some of the most influential militia leaders are working directly with the Americans and pressing for a continued American military presence.
For some of these former militants, America’s display of superior equipment and skills side by side with them in battle brought a newfound respect. Others say they had an ideological reckoning, a realization that years of sectarianism and interference from Iraq’s neighbors had made their nation vulnerable to invasion. Partnering with the world’s superpower, they said, was the best way to bring Iraq back up from its knees.
“We all made mistakes in the past, the Americans, as well as us,” said Hadi al-Ameri, the leader of the Badr Organization, the largest of the Shiite militias that helped battle the Islamic State and the leader of the electoral alliance of former militia members, known as Fatah. “Now, we need their help. We can’t let our country become a playground for other powers and their agendas.”
The vote on Saturday could determine whether the United States military stays in Iraq or leaves.
Most polls show that the front-runners are the current prime minister, Haider al-Abadi, Washington’s closest ally in Iraq, and Mr. Ameri, whose electoral list includes the interior minister, Mr. Araji. If either of them lead the new government, the military partnership is likely to continue.
However, Iraqi political analysts say that the previous prime minister, Nuri Kamal al-Maliki, who demanded the withdrawal of American forces in 2011 and still has close ties to Iran, could play spoiler. They believe he has a good chance of being included in a new coalition government, giving Iran a way to foil America’s growing influence.
So far this year, the American-led coalition has trained six brigades of Iraqi border units, about a quarter of the estimated force required to seal the largely barren, desert frontier with Syria, as well as six brigades of federal police and a special Baghdad-based police force.
The tight-knit nature of the partnership is already on display in several of Iraq’s security hot spots.
On the streets of Mosul, once the largest city in the Islamic State’s so-called caliphate, Iraqi counterterrorism police receive intelligence from American Special Forces deployed at the regional Iraqi command headquarters there and allow the Americans access to Islamic State detainees. On the dusty Syrian border, American and coalition forces provide air surveillance for the border guards newly equipped with American communications and tactical gear. And on Iraqi bases outside Baghdad, coalition teams from Italy, Canada, Denmark and France are training law enforcement units.
But the partnership means that the United States is working with some Iraqis who previously received financing, training and arms from the Iranian Revolutionary Guards Corps, considered a terrorist organization by the American government.
Critics say it’s giving the fox the keys to the henhouse.
“It’s crazy,” Michael Pregent, a retired military intelligence officer in Iraq who now works at the Hudson Institute, a policy research organization. “Americans are sitting with a lieutenant of Qassim Suleimani,” the leader of the Revolutionary Guards, “giving him direct access to American intelligence, weapons and equipment.”
Indeed, Mr. Ameri, the leader of the political alliance of former militia members and a possible next Iraqi prime minister, has a long history of ties to Iran. When Gen. David Petraeus commanded American forces in Iraq during the so-called surge of 2007, and Iranian-armed Shiite militias were killing American forces, he used Mr. Ameri as a liaison to Mr. Suleimani.
But many current and retired American officials who served in Iraq acknowledge that while there is a risk, you work with the partners you have.
“It’s like trying to do business or build relationships in Vietnam without dealing with the former Viet Cong,” said Douglas Ollivant, a retired Army officer and National Security Council adviser for Iraq under two White House administrations. “At some point, America needs to work with men who previously were on the other side.”
Iran, a Shiite theocracy, still wields great power over Iraq, which has a Shiite majority. Iran has extended its influence into Iraq’s political, economic and cultural spheres, and the Shiite militias it bolstered in Iraq give it a low-cost paramilitary force to protect its interests there.
Mr. Ameri led the coalition of Iranian-backed militias, known as the Popular Mobilization Forces, to defend against the Islamic State’s advances toward Baghdad in 2014. Those militias were credited with helping to turn the tide against the extremist group, but some units were also accused of grave human rights abuses, including illegal detentions and extrajudicial killings.
Several other members of Mr. Ameri’s electoral coalition lead prominent Iranian-backed factions that have antagonistic histories with the Americans.
One of them, Sheikh Qais al-Khazali, led the militia that ambushed and killed five American soldiers in the Shiite holy city of Karbala in 2007. He spent three years as an American detainee. More recently, his men fought on behalf of the government in Syria and he has been filmed in Lebanon with Hezbollah commanders touring the Israeli border.
But a regional campaign manager for Mr. Khazali’s group, Habib al-Hillawi, publicly apologized for the American deaths this month. “Times are different now,” he said on the sideline of a campaign rally.
And in a recent interview in his office in Baghdad, Mr. Khazali said that he supported a continued — albeit limited — American presence in Iraq. “Limited and specific training missions would be acceptable to us, as well as an American force proportional to that mission,” he said.
Mr. Araji, the interior minister, says his views have evolved to match Iraq’s political realities.
A secret cable from the United States Embassy in Baghdad in 2007 said the Americans had “good information” that he had been involved in smuggling the Iranian-engineered bombs to Iraq, leading to his imprisonment.
But Mr. Araji denied any wrongdoing, and was ultimately released without charges. In an interview, he said that American intelligence officials had concluded he had been “in the wrong place at the wrong time.”
When he took over the Interior Ministry — which controls the nation’s intelligence agencies, elite counterterrorism forces, border guards, civil defense forces and regular traffic cops — he and like-minded colleagues in the army and government sought to broker new relationships with the coalition.
That agency, too, has a deeply checkered past. While Washington had previously allocated billions of dollars to help Iraq’s domestic law enforcement, the Interior Ministry had been considered too dysfunctional, sectarian and corrupt to build durable partnerships.
A decade ago, rival Shiite militias controlled the Baghdad police, a division of the Interior Ministry, and they were often implicated in kidnappings, killings and even ethnic cleansing of Sunni neighborhoods.
Mr. Araji set a new tone when, as minister, he tried to clean house. He started internal investigations and ousted about 30,000 people who had broken the law, abused their power or “didn’t display the type of behavior conducive to a professional security force,” he said.
He also promoted several long-serving Sunnis to key positions in an effort to integrate the mostly Shiite ministry.
“There have been steps to stamp out favoritism,” said Gen. Ammar al-Kubaisi, a Sunni who heads the Border Guards 2nd Division, responsible for the Syrian frontier. “We still need to work on this, but sectarianism is going away.”
Notably, for the Americans, Mr. Araji publicly supported the international military coalition at critical moments, namely in the aftermath of a 2017 coalition airstrike in Mosul that killed more than 100 civilians.
“My most important goal is to bring security to Iraq,” he said during an angry debate in Parliament. “Iraq is in need of the friendship of the Americans.”
As a safeguard, Iraqi officials have accepted a key requirement for the coalition training: American vetting of each training candidate. Military commanders say this security check, which can take up to two months, is meant to root out former Shiite militia members involved in violence against American forces, or suspected of human rights abuses and other crimes.
Mr. Araji said he did not consider this vetting an infringement on Iraq’s sovereignty, but part of the process of building a stronger nation. People rejected for training know it is a black mark that will sideline their careers, he said in an interview this month at his Baghdad office. “We have zero tolerance for people who have the wrong attitudes.”
Mr. Ameri and Mr. Araji have cooperated with Iraqi army commanders and Prime Minister Abadi to formulate a multiyear training schedule with the international coalition.
So far, training has been approved through 2018. American and Iraqi commanders agree that it is vital for the missions to continue through at least 2020, but further plans have been frozen until after the election.
American commanders, worrying that anti-American political factions could make the coalition training a wedge issue, halted news media access to training operations during Iraq’s election campaign.
Last week, they announced the closing of America’s ground forces command in Iraq, which had been active since 2014. This move is expected to decrease the number of American troops deployed here, currently about 5,000, which was already a fraction of the 170,000 troops serving in Iraq at the peak of American involvement in 2007.
Whoever leads the new Iraqi government will have to tackle the thorny question of what to do with the now-institutionalized militias, either by trying to integrate them into the army’s command structure or leaving them quasi-independent and a potential tool of Iran’s.
Mr. Ameri, as a political and military leader with credibility in the pro-American and pro-Iranian camps, may be best positioned to bring the militias into the fold of the American-trained domestic security forces.
If he wants to.
Mr. Ameri, who is introduced at his campaign events as the “sheikh of the holy warriors,” is vague on the question. In a recent interview, he said only that he believed the state should control the monopoly of force.
For now, the Americans are gambling on his sense of Iraqi patriotism, says Michael Knights, the senior fellow at the Washington Institute for Near East Policy and expert on Iraqi security forces.
“Who is Hadi al-Ameri?” Mr. Knights said. “That is the fundamental question. Is he more loyal to Iran than Iraq? We will only know it when it’s too late.”