BAGHDAD (Reuters) - Rival Iraqi political factions said on Sunday they had each formed alliances capable of forming a government in the new parliament after months of political uncertainty following a May election.

Slideshow ( 2 images )

Lawmakers led by cleric Moqtada al-Sadr and Prime Minister Haider al-Abadi said they created an alliance that would give them a majority bloc in parliament.

A rival grouping led by militia commander Hadi al-Ameri and former Prime Minister Nuri al-Maliki responded by saying it had formed its own alliance that would be the largest bloc in parliament after it got some lawmakers to defect from the other group.

Ameri and Maliki are Iran’s two most prominent allies in Iraq. Abadi is seen as the preferred candidate of the United States, while Sadr portrays himself as a nationalist who rejects both American and Iranian influence.

Iraq’s parliament contains 329 seats and is set to convene on Monday, when it will elect a speaker and launch the government formation process.

Iraqis voted in May in their first parliamentary election since the defeat of Islamic State’s self-declared caliphate, but a contentious recount process delayed the announcement of final results until last month.

The new government will be tasked with rebuilding the country after a three-year war with Islamic State militants and balancing relations between Iraq’s two biggest allies: arch-rivals Iran and the United States.

Uncertainty over the composition of the new government has raised tensions at a time when public impatience is growing over poor basic services, high unemployment and the slow pace of rebuilding after the war with Islamic State.

The recount delayed the process by three months but showed little had changed from the initial results, with Sadr, a populist Shi’ite cleric, retaining his lead of 54 seats. Ameri’s bloc, made up of Shi’ite paramilitary groups, remained second with 48 seats. Abadi’s bloc remained third with 42. Maliki’s bloc came in fifth with 25 seats.

The alliance led by Sadr and Abadi that was announced on Sunday included 20 electoral lists that collectively won 187 seats, a document published by the state news agency showed. It is now in the lead position to form a government.

It includes the blocs of Vice President Ayad Allawi and Shi’ite Muslim cleric Ammar al-Hakim, as well as several Sunni Muslim lawmakers and ones representing Turkmen, Yazidi, Mandaean and Christian minorities.

Ameri and Maliki held a news conference late on Sunday to say they in fact had the largest parliamentary bloc, with 145 seats.

Neither alliance included the two main Kurdish parties, positioning them to reprise the kingmaker role they have historically played, as their combined 43 seats would give whichever alliance they join a sizable numerical advantage.

Since Saddam Hussein was toppled in a 2003 U.S. invasion, power has been shared among Iraq’s three largest ethnic-sectarian components. The prime minister is a Shi’ite Arab, the speaker of parliament a Sunni Arab and the president a Kurd.