A raid ordered by Iraq’s new prime minister on militiamen accused of planning an attack against Baghdad’s international zone could mark a turning point in his government’s efforts to bring Iran-backed groups to heel. The arrest of 14 members of Kataib Hezbollah late last month marked the boldest move yet by any Iraqi leader against the Iran-linked militias, which often operate in Iraq outside the law. Prime Minister Mustafa al-Kadhimi, who took office in May, has vowed to halt their attacks on foreign forces in the country, primarily U.S. troops.

But the response of the powerful militia to the June 26 raid underscores how challenging it will be for Kadhimi to recast the relationship between Iraq’s government and some of the country’s armed groups. After gunmen in pickup trucks cruised Baghdad’s Green Zone demanding their comrades’ release, most were let go, and then welcomed back to the group’s headquarters as heroes. Television stations linked to the militias live-streamed the men burning American flags and stamping on photographs of Kadhimi’s face.

Iraqi militias, including a few with close ties to Iran, played a crucial role in fighting the Islamic State group in Iraq starting in 2014, and many are now an official part of the state security apparatus, receiving salaries and weapons from the government.

But some of the groups, known as Popular Mobilization Forces (PMF), have resisted giving up their autonomy, and militants from Iran-backed militias have repeatedly launched rocket attacks on military and diplomatic locations housing U.S. personnel, prompting American frustration over the Iraqi government’s failure to rein the groups in.