BAGHDAD – Iraqi lawmakers approved an agreement Saturday that aims to bring all of Iraq’s feuding political blocs into a new government led by Shiite Prime Minister Nouri al-Maliki, although deep disagreements remain about the role to be played by the country’s minority Sunnis.

The deal struck last week ended an eight-month impasse that had stalled the formation of a new government and threatened to re-ignite sectarian violence. But the agreement appeared on the brink of collapse almost immediately after it was announced because of the deep-rooted distrust that pervades Iraq’s sectarian politics.

The Sunni-backed Iraqiya bloc had threatened to boycott the Saturday session to approve the deal after storming out of parliament Thursday and raising fears the group would abstain from government altogether. Iraqiya lawmakers said they had been betrayed by al-Maliki’s Shiite coalition, who they fear is trying to deprive them of a significant role in the next government.

Leaders of the major parties met early Saturday to try to salvage the deal. When parliament convened later in the day, Iraqiya was present and took part in the parliament vote to approve the power-sharing agreement.

“There was a misunderstanding in the last session,” Iraqiya spokesman Haider al-Mulla told lawmakers. “We here stress that we will be an active part in producing a national unity government.”

Under the agreement, al-Maliki and President Jalal Talabani, a Kurd, keep their current posts. Iraqiya, meanwhile, gets the parliament speaker’s post as well as the top spot on a council intended to serve as a check on al-Maliki’s powers.