The deal breaks an eight-month impasse that paralysed the government and raised fears insurgents were taking advantage of the political deadlock to stoke violence.

Members of the Sunni-backed secular coalition that had been so vehemently against Mr Maliki in the end resigned themselves to serving in his government.

"Finally, fortunately, it's done. It's finished. All the groups are in it," said Kurdish MP Mahmoud Othman, who took part in the seven-hour negotiations which nailed the deal, along with talks during the previous two days.

An official in the Iraqiya Sunni-backed coalition has confirmed that a deal had been reached.

The general outlines of the deal are that president Jalal Talabani, a Kurd, will keep his largely ceremonial job and that Iraqiya will choose the parliament speaker.

The compromise plan would also create a new council with authority over security issues - an idea promoted by US officials as a way to keep Iraqiya in the government. If the council proves to have real authority, it could serve as a small victory for Iraqiya.

It is as yet unclear what role, if any, Iraqiya's leader, former prime minister Ayad Allawi, would play in the government.

Ever since the March 7 vote, Iraqi MP have tussled back and forth over who would lead the new government. Iraqiya was able to capitalise on widespread Sunni frustration with the Shia-led government to get 91 seats in the election, compared with 89 for Mr Maliki's bloc.

But despite Iraqiya's bragging rights as the victor, it was never able to find the political partners it needed for a majority and recently Mr Maliki gained momentum as he gathered new allies, like followers of anti-American cleric Muqtada al-Sadr. It is not known what role Sadr or his hardline Shia faction might play in a new government.