The results were also contested on grounds of fraud, with the outgoing parliament ordering a manual recount of the votes, a decision upheld by Iraq’s highest court. It was unclear, however, whether the new parliament would carry out that decision.
It was also unclear whether the new alliance brought Iraq’s political factions any closer to a decision on who will lead the next government.
In Iraq’s complex electoral terrain, none of the four major groupings among the majority Shiites appears to have enough seats, even in coalition with all other Shiite parties, to form a government and choose a new prime minister. That will mean forming a coalition with Sunni and Kurdish parties as well.
In addition, one of those Shiite groupings, led by former prime minister Nuri Kamal al-Maliki, has refused to make common cause with the other Shiite groups.
The election results came as a blow to Mr. Abadi, despite popularity in some quarters of Iraq for his government’s victory over the Islamic State and its success in stopping an independence bid by the country’s restive Kurdish population in the north.
It was not clear whether the two leaders’ political alliance had agreed on any one candidate as their choice for prime minister. But a spokesman for Mr. Sadr said that Prime Minister Abadi did not insist on continuing as prime minister in exchange for his support.
Jaafar Almosawi, Mr. Sadr’s political spokesman, said that the Sadr faction already had five people under consideration for the role of prime minister, but that issue did not come up in the alliance negotiations.
“We did not talk about the next prime minister,” he said.
Political analysts said the latest alliance was a movement toward bringing all of the Shiite groups together, but it also increased uncertainty about who would emerge as leader. “Two or three days ago we thought the candidate for prime minister would be Hadi al-Ameri, but now there is talk about nominating Haider al-Abadi again,” said Wathiq al-Hashimi, head of the Iraqi Strategic Studies Group, a think tank in Baghdad.