An alliance headed by the former Shia militia chief Moqtada Sadr has won the parliamentary elections in Iraq.
Final results released by the electoral commission give his Saeroun bloc 54 seats, with current Prime Minister Haider al-Abadi in third place with 42.
Mr Sadr, a long-term adversary of the United States, cannot become prime minister himself as he did not stand as a candidate.
But he is expected to play a major role in forming the new government.
Mr Sadr has reinvented himself as an anti-corruption champion after making his name as a militia chief fighting US forces after the 2003 invasion of Iraq.
He is also a fierce critic of Iran.
These elections were the first since Iraq declared victory over the Islamic State group in December.
Some 5,000 American troops remain in Iraq supporting local forces, which were fighting IS.
The Saeroun (Marching Towards Reform) list is an alliance between Mr Sadr’s Istiqama (Integrity) party and six mostly secular groups, including the Iraqi communist party.
It pushed the pro-Iranian Fatah (Conquest) alliance into second place with 47 seats.
Fatah combines the political wings of militias in the Shia-led paramilitary Hashd al-Shaabi (Popular Mobilisation) force and is led by former Transport Minister Hadi al-Amiri.
The defeat of Mr Abadi’s alliance came as many voters expressed dissatisfaction with corruption in public life.
Mr Sadr’s party and its allies campaigned on a platform of fighting corruption and investing in public services.
Despite Mr Abadi’s poor showing, he may yet return as prime minister after negotiations which must now be completed within 90 days to form a new government.
Whoever is named prime minister will have to oversee the reconstruction of Iraq following the battle against IS, which seized control of large parts of the country in 2014.
International donors pledged $30bn (£22bn) at a conference in February but Iraqi officials have estimated that as much as $100bn is required. More than 20,000 homes and businesses were destroyed in the second city of Mosul alone.
More than two million Iraqis are still displaced across the country and IS militants continue to mount deadly attacks despite having lost control of the territory they once held.
Turnout at the 12 May election was only 44.5% – much lower than in previous polls.