BAGHDAD – Iraq’s two largest Shiite electoral blocs announced Tuesday they have formed an alliance that gives them a strong chance of setting up the next government, though they have yet to work out the contentious question of who would become prime minister.

The deal between Prime Minister Nouri al-Maliki’s State of Law coalition and the conservative Shiite Iraqi National Alliance leaves them just four parliamentary seats shy of a ruling majority.

The union could cement Shiite domination of Iraq’s government and further alienate minority Sunnis who lost their positions of privilege with the fall of their patron Saddam Hussein in the 2003 U.S.-led invasion.

Such an outcome threatens to stir further violence at an especially fragile moment in Iraq as American troops prepare to withdraw. It could also ensure that neighboring Shiite power Iran maintains influence in Iraqi affairs.

The question of who would be prime minister could threaten to derail their plans to form a government, however.

“Despite the challenges and the risks, both coalitions have agreed to announce the formation of a single parliamentary bloc,” said Abdul-Razaq al-Kazemi of the Iraqi National Alliance.

Al-Kazemi, who took no questions from reporters, was flanked by officials from State of Law and the movement of radical cleric Muqtada al-Sadr, whose followers make up the strongest group in the Iraqi National Alliance.

Iraq’s close fought election on March 7 produced no clear winner, forcing extensive negotiations between the political factions and deepening divisions as the political debate has dragged on for almost two months.

Adding to the confusion are the steps al-Maliki has taken to challenge the election results, which showed his coalition with a two-seat deficit to the Iraqiya coalition of former Prime Minister Ayad Allawi, a Shiite who won solid Sunni backing by campaigning for an end to sectarian politics.

Al-Maliki successfully demanded a recount of Baghdad votes, and a committee tasked with vetting candidates for ties to Saddam Hussein’s regime has tried to bar many politicians on Allawi’s electoral list.

The Shiite alliance came about because the Shiite parties were worried about Allawi’s chances of forming a government and decided to outmaneuver him, said Joost Hiltermann from the International Crisis Group.

“The way to prevent Allawi from forming a government is to make sure he doesn’t get a chance,” he said.