BAGHDAD — Emboldened by a call to arms by the top Shiite cleric, Iranian-backed militias have moved quickly to the center of Iraq’s political landscape, spearheading what its Shiite majority sees as a fight for survival against Sunni militants who control of large swaths of territory north of Baghdad.

The emergence of the militias as a legitimate force enjoying the support of the Shiite-led government and the blessing of the religious establishment poses a threat to Iraq’s unity, planting the seed for new sectarian strife and taking the regional Shiite-Sunni divide to a potentially explosive level.

Iraq’s Shiite militias attacked U.S. forces during the eight-year American presence in the country. They also were in the lead in the Sunni-Shiite killings of 2006-2007, pushing Iraq to the brink of civil war. Their death squads targeted radical Sunnis and they orchestrated the cleansing of Sunnis from several Baghdad neighborhoods.

More recently, Shiite militias have been battling alongside the forces of President Bashar Assad and Lebanon’s Shiite Hezbollah against mostly Sunni rebels and militants in neighboring Syria.

Some of them have returned home to Iraq – first to fight Sunni militants in Anbar province, and now on Baghdad’s northern fringes and in Salahuddin and Ninevah provinces.

Those are the areas where the Sunni militants from the Islamic State of Iraq and the Levant, or ISIL, captured cities and towns in a lightning offensive last week.

Security officials said Shiite militiamen have been fighting for months on the government’s side against ISIL fighters in areas west of Baghdad in mainly Sunni Anbar province as well as parts of Diyala province northeast of the capital. They also have been fighting Sunni militants south of Baghdad. Their involvement, however, has never been publicly acknowledged by the government of Prime Minister Nouri al-Maliki.

Their enhanced role in the fight against the Sunni militants will deepen Iran’s influence in Iraq, giving the non-Arab and mostly Shiite country a role similar to the one it plays in Syria.

Tehran has thrown its weight behind Assad’s government in his struggle against mostly Sunni rebels and militants from al-Qaida-inspired or linked groups.

Shiite militiamen interviewed by The Associated Press in the past two days talk of undergoing training in Iran and then being flown to Syria to fight on the government’s side.

Once there, they say they are met by Iranian operatives who give them weapons and their assignment.

The militiamen, interviewed separately, paint a picture of their groups as being inspired by what they call a “grave” threat to their community.

They say they have been motivated by the call to arms by their most revered cleric, the Iranian-born Grand Ayatollah Ali al-Sistani.

Their comments also suggest a high level of acquiescence by al-Maliki’s Shiite-led government. Six years ago, the government battled the Shiite militias in Basra.

Now, al-Maliki publicly meets with militia leaders, like Qais al-Khazali of the Iranian-backed Asaib Ahl al-Haq, or League of the Righteous, a group that staged attacks against U.S. troops before their withdrawal in 2011.