By Stephen Kalin

BAGHDAD, Dec 1 (Reuters) - In early June, two Iranian-backed Shi'ite militias under the nominal control of the Iraqi government stormed into an Iraqi military airbase north of Baghdad. Driving armoured vehicles and wielding rocket launchers, they took over a building on the base.

The Iraqi commander at the base, near the town of Balad, asked the militiamen to leave. But the men ignored him as well as orders from the central government in Baghdad, according to two army officers in the Salahuddin Operation Command, the regional military headquarters.

The June standoff grounded four Iraqi F-16 fighter jets and pushed more than a dozen U.S. contractors - there to help local pilots bomb Islamic State militants - to flee, according to the army officers and an Iraqi military intelligence source.

It also underscored one of the biggest challenges ahead for Iraq.

Baghdad is currently battling to prise hardline Sunni group Islamic State from the northern city of Mosul. In that struggle, government troops are fighting alongside the country's Shi'ite militias, as well as Kurdish and U.S. forces.

But the government of Prime Minister Haider al-Abadi knows that even if it defeats Islamic State it needs to bring the Shi'ite militias under greater control. Iraqi and Western officials alike say episodes like the one in Balad raise serious questions about Abadi's ability to do that.

The militias came together in 2014 after Islamic State seized a third of the country. Officially, the militias form a government-backed popular fighting force called the Hashid Shaabi, which has been instrumental in protecting Baghdad and pushing back Islamic State.

But the militias have also created headaches for the government. Many of them have ties to Iran and have amassed vast military and political influence. Sunni Iraqis and human rights groups have accused some of them of rights violations, torture and murder.

The militias deny the charges of abuse, torture and murder, and say they are simply battling Islamic State terrorists.

At the Balad airbase in June, Iraqi army troops dealt with the rogue fighters by walling off the section of the base they had seized. The fighters eventually agreed to leave for a local farm after the intervention of their boss, Qais al-Khazali. He leads Asaib Ahl al-Haq, one of Iraq's fiercest Shi'ite militias.



SIGNS OF PROGRESS

Abadi came to power in 2014, promising to mend wounds between Iraq's Shi'ite majority and Sunni minority. The latter dominated the country during Saddam Hussein's iron-fisted rule and have chafed under Shi'ite governments since his toppling in 2003.

To promote national unity, Abadi has promised to rein in the militias. Technically, the Hashid Shaabi reports to the prime minister through long-time national security advisor Falah Fayyad. Other Hashid leaders hold official positions. Spokesman Ahmed al-Assadi, for example, is a lawmaker. As well, Baghdad allocates salaries for about 110,000 Hashid members.

But Western diplomats say money for Shi'ite fighters is regularly dispensed through commanders, giving them de facto control of the purse strings. And the Hashid routinely presents itself as loyal to the Iraqi people rather than the state. Fayad's deputy Abu Mahdi al-Mohandes - many militia members see him as the Hashid's real leader - is a veteran commander with long-standing ties to Iran.

Iraqi and Western officials say Abadi is too weak to take on the militias directly. When he first came to power, the prime minister tried to integrate the Hashid Shaabi into the regular security forces but that plan quickly died.

Now he is pursuing a softer approach. In February he issued an executive order meant to nudge militias into accepting government control. Diwan Order 91 directs the Hashid Shaabi to become "an independent military formation, part of the Iraqi armed forces and linked to the commander-in-chief of the armed forces ... on the current model of the counter-terrorism service."

In November, parliament passed a law to that effect which also calls on fighters to cut party affiliations and refrain from practising politics.

There are signs of progress. After leading the fight against Islamic State in 2014 and 2015, the Hashid has mostly played a supporting role in recent government advances. Reuters has seen a memo Mohandes sent in June that directed fighters to eliminate factional flags and chants.

But the militias remain outside the control of the defence ministry. They dominate in and around Baghdad, throughout eastern Diyala province and in large parts of Salahuddin province further north. And they still raise religious banners that portray Shi'ite imams and logos of partisan groups.



SECRET PRISONS

The militias also control at least half a dozen of their own prisons, according to local officials, police and army sources. One is located in Jurf al-Sakhar, a town south of Baghdad that was captured by security forces and militia fighters in 2014.

According to one national security official, the town and surrounding area is still controlled by Kataib Hezbollah, one of the most secretive of the Shi'ite militias in the Hashid Shaabi. The U.S. Treasury calls the group a terrorist organisation.

"More than a year ago, the Kataib group set up their own detention centres and turned multiple former government buildings and large houses into tightly secured detention centres," said the official. "All we know is that hundreds of prisoners from Anbar (province) are detained ... The group is conducting its own investigations ... and security forces have made no contribution at all to these procedures."

A senior local official confirmed Kataib ran its own prisons and said many of the inmates were Sunnis who had been detained at a checkpoint in Razzaza, a desert area separating western Anbar province from Shi'ite shrines in the south.

Ahmed Salmani, a lawmaker from the nearby Sunni town of Qaim, said around 2,200 people are being held there. He said he had discussed their fate, including incidents of torture, with the defence and interior ministries as well as Abadi.

One local said he had three sons who were rounded up at the Razzaza checkpoint. One was killed, he said. "I lost my three sons in front of my eyes at that ominous checkpoint," said the man, who paid $20,000 to have three of them returned. But "the oldest one, Omar, had been tortured to death."

Kataib Hezbollah spokesmen Jaafar Hussaini said reports of secret prisons were "baseless and a shameless attempt to distort the image of Kataib." He said the group was operating alongside the army, police and counter-terrorism forces to keep Islamic State out of the area.



REINING IN THE NUMBERS

Western diplomats say the Hashid's ranks could be halved if Iraq manages to defeat Islamic State. But they also fear a hardcore could evolve into something resembling Iran's elite Revolutionary Guard. That would help cement the influence Tehran has gained in Iraq since Saddam's fall.

But according to one senior diplomat in Baghdad, Iranian officials have expressed their unwillingness to treat Iraq like a protectorate. "They keep telling us they can't manage a client state," the diplomat said. Senior Iraqi security officials also reject any further increase in Iranian influence.

The Iranian embassy in Baghdad did not respond to repeated requests for comment.

Militia leaders themselves are split, with some suggesting they will not lay down their arms even if Islamic State is defeated.

Jawad Talabani, a commander in Asaib Ahl al-Haq, said groups like his see no need to join the official Iraqi security forces. He said his militia would only lay down its weapons once all Sunni groups are defeated, and will resist forced disarmament.

"The role of the security forces is to protect the Iraqi people and we will support the security forces if that is requested from us," he told Reuters.

Kareem Alewi al-Mohamadawi, a spokesman for the Badr Organisation, the single biggest Shi'ite militia, said the group would revert instead to its pre-2014 status, with some members serving in the police and others operating independently.

But the big groups are less of a concern to Iraqi officials and Western diplomats than smaller, more radical ones that take more direct support from Iran.

Earlier this year, Baghdad began working with the United Nations to establish a demobilisation programme for Hashid members who consent to give up their arms. Senior Iraqi security officials say the aim is to cut the size of the Hashid significantly. But with the fight against Islamic State not yet over, the programme has not started.

Rebuilding the regular military, which was crippled by corruption and sectarianism and then overrun by Islamic State in 2014, will take time, according to officials.

In June, when black-clad commandos from the government's elite counter-terrorism service marched in Baghdad with army and police units to celebrate the restoration of Falluja, Hashid forces marched beside them. Abadi looked on, saluting from a viewing platform.

A colonel in the police command of Tikrit, a Sunni town now adorned with Shi'ite militia banners and pictures of Iran's Supreme Leader, put it this way: "We don't have any authority over them (the militias). They are a state inside a state." (Edited by Michael Georgy and Simon Robinson) ((stephen.kalin@thomsonreuters.com; Reuters Messaging: stephen.kalin.thomsonreuters.com@reuters.net))