Ceerwan Aziz/AP -
Iraqi Prime Minister Nouri al-Maliki, left, and Kurdish regional President Massoud Barzani, attend a press conference in Irbil, last month in June. Following spike in violence, Maliki has sought alliances with other groups in Iraq.

BAGHDAD — As Iran exerts its considerable influence in Syria and around the region, it is meeting resistance from an unlikely source: Iraq’s polarized and faltering democracy.

Iraqi Prime Minister Nouri al-Maliki, who once sought refuge in Iran as an exile, has officially maintained his neutrality while his eastern neighbor have thrown its full support behind the Syrian regime. Out of political necessity, he has also recently made significant efforts to build alliances with moderate Iraqi Sunni groups, offering a hint of cross-sectarian cooperation in a region increasingly defined by religious schism.

“Our Iranian brothers do not like it,” said a close adviser to Maliki, speaking on the condition of anonymity because of the sensitivity of the subject.

Sectarian rivalries around the region have combusted in the heat of the Syrian civil war, and Iraq has been caught in the middle. Iraq’s Shiite majority lives mainly in the eastern part of the country, closer to Iran, which has supplied weapons and fighters to Syrian President Bashar al-Assad. Iraqi Sunnis, who compose about one-third of the population, live mainly in the west and north, closer to Syria, where the overwhelmingly Sunni rebels have received support from Turkey, Saudi Arabia and Qatar.

The Shiite-led Iraqi government has avoided taking sides, at least overtly. Although many leaders worry that a new regime in Syria would be hostile to Iraq, they are more concerned about minimizing domestic unrest. And although the government has looked the other way while Iran has shuttled arms to Damascus through Iraqi airspace, it also has responded to diplomatic pressure from the United States by inspecting some flights and refraining from giving more direct support.
“A military solution is not a solution” to the Syrian conflict, Ali Musawi, a spokesman for Maliki, said.

Still, Iraq has been deeply affected by the conflict, with Iraqi militant groups fighting on both sides. Al-Qaeda in Iraq has formally allied with extremist rebel groups in Syria, while Iraqi Shiite militias that are backed by Iran have deployed fighters to defend the Assad regime.

And the turmoil has spilled into Iraq, which recently suffered its three deadliest months in five years, fueling fears of a return to the sectarian civil war that consumed Iraq in 2006 and 2007. Energized by the fight across the border, Sunni militant groups have stepped up attacks. They also have taken advantage of discontent among the Sunni population, in some cases infiltrating otherwise peaceful demonstrations.

In response to this upheaval, Maliki initially seemed to take advice from Gen. Qassim Suleimani, the Iranian Revolutionary Guard Corps commander who runs Iran’s operations in Iraq and Syria. Iran funnels millions of dollars to Shiite political candidates in Iraq, and it also has funded, trained and equipped Shiite militias. Iraqi politicians say it is common knowledge that the Iranian Embassy is a Revolutionary Guard headquarters, with the ambassador reporting to Suleimani.