“That foreign influence has canceled itself out,” said Abbas Kadhim, an Iraqi historian and political analyst. “At the end of the day, the U.S. and Iran work against each other, and they both made each other fail in getting what they want.”

AD

AD

After previous Iraqi elections, the United States and Iran engaged in furious backroom dealmaking until both sides were satisfied with the selection of prime minister, Kadhim said. “All prime ministers were prime ministers agreed to by both the U.S. and Iran,” he said.

But this year, American and Iranian officials have been unable to find their footing in shaping Iraq’s incoming government. The Iraqi political scene has been roiled by a boiling over of public frustration with government incompetence and by the bellicose rhetoric between Washington and Tehran.

Soleimani has been spending his time urging Shiite parties to set aside their differences and merge to form a parliamentary majority, thus winning the right to nominate the next prime minister. Soleimani has long been involved in the country’s Shiite politics and with armed groups backed by Iran. His prominent role in the military campaign to oust the Islamic State from Iraq further enhanced his standing.

AD

AD

But the normally sure-footed Soleimani has seen his political efforts rebuffed and his preferred candidate for prime minister drop out of contention.

McGurk, who is the U.S. envoy to the coalition battling the Islamic State, has not fared any better in Baghdad and, for some Iraqis, has become the face of waning U.S. clout in Iraq.

Despite Washington’s traditional influence with many Sunni and Kurdish politicians, McGurk could not secure their support for Prime Minister ­Haider al-Abadi. A pro-American Shiite, Abadi had led Iraq to battlefield victories over the Islamic State and steered the country through an economic crisis while emphasizing national unity over sectarianism, but his ticket fared poorly in the national elections.

AD

Earlier this month, the former governor of the Sunni province of Anbar, Mohamed al-Halbousi, was chosen as speaker of parliament at the expense of the U.S.-backed candidate, a former defense minister. Halbousi’s selection was the product of internal Iraqi negotiations, though he has signaled a willingness to work with both the United States and Iran.

AD

“There has been always competition between the U.S. and Iran, but not publicly like it is now,” said Youssef al-Kilabi, a lawmaker aligned with Abadi. “Both of them are using their leverage to choose the prime minister. . . . If this competition continues like this, I don’t know who will win, but for sure I know who will lose, and it’s the Iraqi people.”

As months have passed without a new government, the aggressive lobbying seems to have spilled over into violence.

AD

Protesters in the oil-export city of Basra torched the Iranian Consulate this month, saying they had acted out of anger over Iran’s role in Iraq’s politics and Iranian support for Iraqi militias that hold sway in the city. Soleimani’s Iraqi allies blamed the United States, accusing the U.S. Consulate in Basra of supporting the demonstrators and placing saboteurs among them. No evidence for the claims was given.

AD

Around the same time, rockets were lobbed toward the U.S. Consulate in Basra and the U.S. Embassy in Baghdad. None of the projectiles hit the diplomatic missions.

A Western official said the rockets were fired by Shiite militias aligned with Iran and reflected Iran’s frustration with its inability to impose its will on Iraq’s political process. There was no evidence that the attacks were ordered by Soleimani or Tehran.

AD

“Out of the friction of all that, the rockets came,” said the official, who spoke on the condition of anonymity to discuss private deliberations. Iran “did not succeed in building the largest bloc, and they were extremely frustrated because they thought that the United States had blocked them in doing that.”

Iran’s ambassador to Iraq did not respond to calls asking for comment on his country’s role in forming Iraq’s government.

AD

In an emailed statement, U.S. Ambassador to Iraq Douglas Silliman said, “The United States respects Iraq’s democratic process and supports a strong, sovereign, and independent Iraq. The U.S. government looks forward to working with the new government to help it provide essential services to all of its citizens.”

AD

In the May elections, a coalition backed by populist Shiite cleric Moqtada al-Sadr, a critic of both American and Iranian involvement in Iraq, won the most seats in parliament, followed by a ticket composed of figures from pro-

Iranian Shiite militias. Abadi’s ticket, considered the most pro-American, came in third.

Those results left neither the United States nor Iran with a large enough foundation on which to build a parliamentary majority.

“Both have reached to a dead end,” said Qusai al-Sohail, a senior negotiator with the pro-Iranian bloc of Shiite militia leader Hadi al-Amiri and former prime minister Nouri al-Maliki.

AD

At the same time, the United States is offering lawmakers fewer incentives for their support. Washington has not provided funds to rebuild cities decimated by the fight against the Islamic State, instead urging other Arab nations and the European Union to pour billions into Iraq’s infrastructure.

AD

The main U.S. contribution is a large contingent of American troops to train and help maintain Iraq’s security forces. Most Iraqi politicians see the troop presence as necessary, but it has rankled Iran’s allies in the country.

Iran, for its part, has supported its allied Iraqi militias with money and arms. But those militias have become a liability with a public that sees the pro-Iranian groups profiting while the population suffers economic hardships.

Kilabi, the lawmaker allied with Abadi, says Iraqi politics are experiencing an “awakening” as the public puts aside religious and ethnic loyalties and instead demands tangible improvements in the quality of life.

AD

AD

That evolution has thrown traditional political dealmaking into disarray. For the first time since Iraq began holding democratic elections in 2005, Shiites, Sunnis and Kurds are each deeply divided over whom to back for top positions that each group is guaranteed under Iraq’s political quota system.

Sunnis were split over whom to put forward as speaker of parliament. The dominant Kurdish parties have nominated rival candidates for president, a dramatic departure from their normally united front in Baghdad. And ­Shiites have been unable to unite behind a single candidate for prime minister.

The Western official said it is likely that Iraq’s next prime minister will emerge from the political center, largely because of Grand Ayatollah Ali Sistani. The Shiite cleric, whose recommendations are highly influential among Iraq’s politicians and public, has responded to the political gridlock by declaring that Iraq’s next leader should be an independent who has not held any position of authority in the past.

AD

“It’s better for Iraq to be seen as having a measure of independence,” said Kadhim, the political analyst. “It's better for both sides to see Iraq as an ally rather than a proxy or a toy to play with.”