BAGHDAD — Sustained protests in Iraq’s Shiite heartland this summer have dimmed the prospects that the nation’s staunchly pro-American prime minister will wrest a second term, with demonstrators channeling their frustration about poor basic services into a broad condemnation of his leadership.

The protests, which have morphed from chaotic and sometimes violent marches into daily sit-ins, have prompted powerful religious and political figures to zero in on Prime Minister Haider al-Abadi as the source of Iraq’s many troubles. This could cost him another term, despite his widely acclaimed success last year in leading the Iraqi government to victory over the Islamic State and firmly turning back a Kurdish bid for independence.

Although his ticket performed poorly in national elections this spring, finishing far behind that of firebrand Shiite cleric Moqtada al-Sadr, political observers had speculated that Abadi might retain his position in a coalition government.

Instead, the mounting popular discontent has dealt him an abrupt setback. For the United States, this recent turn exposes a weakness in a strategy that centered on supporting Abadi in the hope that his message of anti-sectarian nationalism would translate into a new era of Iraqi politics.

If Abadi does not win a second term, the United States will face the prospect of a new Iraqi administration that is less sympathetic to Washington and more open to Iran at a time when President Trump has reimposed economic sanctions on Tehran and threatened military action.

Both Sadr and Hadi al-Amiri, a Shiite militia leader whose ticket finished second in the elections, have a long history of opposing U.S. forces and consider American involvement in Iraq a continuation of the occupation that began in 2003. While Sadr has publicly opposed Iranian influence in Iraq and the region, Amiri has benefited from Iranian military and financial support.

“The U.S. certainly miscalculated by so openly pushing for a second term for Abadi,” said Nussaibah Younis, an Iraq expert with Chatham House, adding that Washington should have emphasized its priorities for the Iraqi government rather than focusing on a specific individual. “Pushing for a continuation of Abadi was the easy way for the U.S. to try to protect the gains it has made in Iraq over the last four years without having to do the substantial groundwork that would have been required to build up a range of political alternatives.”

Ahead of national elections in May, Abadi was largely viewed as the front-runner, owing to his stewardship of the country as Iraq fought to reclaim territory lost to the Islamic State and navigated an economic crisis driven by plunging oil prices. He also was credited with seeking to bridge Iraq’s divide between Sunnis and Shiites.

He further burnished his credentials by ordering a military response to a Kurdish referendum on whether to seek independence from Iraq. That firm action seemed to erase the notion that he was weak

But in an election that had a historically low voter participation of 44 percent, Abadi’s once muscular position was severely diminished. The votes are being recounted after evidence showed widespread irregularities and fraud was alleged, but the tally is not expected to change significantly.

The nearly three-month delay in certifying the election has contributed to the mounting criticism of Abadi and has weakened his bid for a second term as the winning political blocs negotiate the formation of a new government.

Abadi has declined to discuss his reelection prospects. He was heavily criticized for initially responding to the protests with force but has more recently softened his approach, saying the demands of the protesters are legitimate and promising immediate economic relief.

At first, Sadr said he would support Abadi to lead the new government. Last week, however, as street protests continued, Sadr outlined conditions that spoke to the demands of demonstrators for change. In part, Sadr said the new prime minister should be an independent who has not held elected office. That stipulation alone would eliminate Abadi from contention. 

It followed an earlier swipe from the country’s highest Shiite religious authority, Grand Ayatollah Ali Sistani.

During a recent televised Friday sermon, watched by millions, a representative of the reclusive ayatollah defended the protesters and said their demands were legitimate. He then said: “The prime minister assumes full responsibility for the performance of his government. He must be strict, firm and courageous in fighting the financial and administrative corruption — which is the basis for most of the country’s bad situation.”

That critique was largely considered a rare rebuke of Abadi by the religious establishment, which had supported him during his term, and revived the earlier criticism that he was weak. Just hours after the sermon, demonstrators who have been gathering weekly in Baghdad’s Liberation Square began turning their ire on Abadi, for the first time explicitly skewering his leadership.

“I have participated in all the protests, but today I am here especially against Abadi,” said Mohammed Ismail, 63, holding a picture of the prime minister with the word “leave” printed on it.

“Since Abadi received the post, he didn’t fulfill any of his promises,” Ismail said. “He had a golden chance when all the people supported him to make reforms, but he was too weak to do any of them. He is not the right person to lead Iraq.”

Ahmed Adnan, 29, said Abadi had squandered unprecedented backing from parliament, Sistani and regular Iraqis.

“But he was too stupid and too much of a coward to use the support, and now all these three parts are against him,” he said.

Hamid al-Mutlaq, a Sunni member of parliament, said that an Abadi reelection would be acceptable but that the protests have allowed other parties to sideline him.

“Abadi is the best among all the previous prime ministers, but still, he has shown his weaknesses more than once,” he said. “He couldn’t punish the corrupt and he couldn’t face the armed militias. He won’t be able to run the country in the next stage.”

A leading official close to the political negotiations, who spoke on the condition of anonymity to discuss the sensitive talks, said Abadi’s electoral ticket is no longer considered an essential partner to the two emerging power centers: Sadr’s majority bloc, supported by the Shiite Hikma group, and Amiri’s bloc, supported by former prime minister Nouri al-Maliki.

Abadi’s ticket has been relegated to the same minority status as Kurdish and Sunni parties, which are viewed as secondary partners in forming a government, the official said.

In addition, a new name has emerged as a potential successor to Abadi from within his own Dawa party, Tariq Najm, a former chief of staff for Maliki, the official said.

Still, Abadi’s allies say the prime minister could retain his seat if he emphasizes his gains against the Islamic State and points out that protesters have fixed their ire on the entire political class, including rival parties.

“Due to the protests and the anger of the people, they wouldn’t take the risk of choosing a new person to the post who will start from zero,” said Shamil Kahiyya, a member of the Dawa party.

But Younis, the Chatham House analyst, said the call for a “fundamental change in approach” by both the religious establishment and the protesters has undermined any value of political continuity.

“Abadi could still hang on if the political blocs struggle to identify an alternative compromise figure,” she said. “But there is now a recognition that such a decision will not help to placate Iraqi citizens who are calling for radical change.”