BAGHDAD (AFP) - Iraqs deeply divided political factions have sealed a power-sharing deal more than eight months after an inconclusive general election paving the way for MPs to elect a speaker on Thursday. The deal, clinched late on Wednesday night after three days of high-pressure talks between the rival factions, sees Shia Prime Minister Nuri al-Maliki returning to office for a second term, Jalal Talabani, a Kurd, expected to retain the presidency and a Sunni MP being elected as speaker of parliament. The agreement paves the way for an end to a months-long power vacuum that has witnessed growing violence in the country. Washington had expressed mounting exasperation with the protracted coalition talks but had pushed throughout for a unity government that gave a stake to all of Iraqs ethnic and confessional groups, a goal it finally secured. The Iraqiya bloc of former prime minister Iyad Allawi, who had held out for months to take the premiership from Maliki after it won narrowly more seats in the March election, confirmed it had finally signed up to the deal. I can confirm that there was an accord last night but I cannot give details, Iraqiya spokesman Intissar Allawi told AFP. The support of the bloc, which won most of its support among the Sunni Arab minority that dominated Saddam Husseins regime and has been the bedrock of the anti-US insurgency since the 2003 invasion, was seen as vital to prevent a resurgence of violence. Government spokesman Ali al-Dabbagh said that Iraqiya had agreed to accept the position of parliament speaker - not the premiership or the presidency they had long sought. Under the power-sharing arrangements between Iraqs divided communities, one post goes to a Sunni Arab, one to a Kurd and one to a representative of the Shia majority. A power-sharing agreement has been concluded and parliament will meet at 3:00 pm (1200 GMT) to elect Osama al-Nujaifi as speaker, Dabbagh told AFP, referring to a Sunni MP from Iraqiya. The election of the speaker will pave the way for Talabani of the Kurdish former rebel group, the Patriotic Union of Kurdistan to be kept in office for a further term. It will then fall to him to name a prime minister-designate - Maliki - who will have one month to form a government that can win a parliamentary majority. Despite the 11th-hour deal, it was clear that loose ends remained to be sorted and that Iraqiya negotiators still needed to meet with leaders of the bloc to explain the details of what they had signed up to. The leaders of Iraqiya are to meet today before parliament convenes, the blocs spokesman said. A parliamentary source said that a committee had been formed to hammer out the remaining details of the sharing of power. The 11th-hour talks had continued well into the night. On Wednesday, Maliki blasted his rivals in Iraqiya for boycotting the talks the previous day. Even if there are differences it should be remembered that we are in the same boat, Maliki said after Allawi failed to show up on Tuesday. But if these differences are not managed responsibly they can easily degenerate into conflict, he said against the background of a flare-up in violence that some leaders have blamed on the power vacuum.