Iraq's cabinet on Sunday approved a security pact with the United States that will allow American forces to stay in Iraq for three years after their UN mandate expires at the end of the year, the government said. The decision followed months of difficult negotiations and, pending parliamentary approval, will remove a major point of contention between the two allies. Government spokesman Ali al-Dabbagh said all but one of the 28 Cabinet ministers present in Sunday's meeting, in addition to Prime Minister Nouri al-Maliki, voted in favor of the pact by a show of hands. The Cabinet has 37 members and it was not immediately clear why some ministers stayed away. Several of them were believed to be traveling abroad. "This is an important and positive step," said US Embassy spokesman Adam Ereli. Al-Dabbagh said the agreement will be submitted to parliament later Sunday, but did not say when the 275-member legislature will vote on the document. Parliament is scheduled to go into recess at the end of the month or in early December because of the Muslim Eid al-Adha holiday, when scores of lawmakers travel to Saudi Arabia to perform the annual pilgrimage. "I'm optimistic that this agreement will be passed through the Council of Representatives (parliament)," al-Dabbagh told Associated Press Television News. But he added: "You cannot guarantee 100 percent approval of anything." Neighboring Iran has bitterly opposed the pact on grounds that it enshrines the US military presence in Iraq and threatens its security and regional influence. However, Iranian state television took a more nuanced position in a commentary Sunday after it became clear that emboldened Iraqi leaders were going their own way on the pact. "This is a victory for the al-Maliki government, which was able to apply its own viewpoints," it said in a possible reference to American concessions to demands from Iraqi negotiators. Still, it was unclear if the commentary represented a shift in Iranian government opinion about the pact following Iraqi Cabinet approval. Shi'ite Iran maintains close relations with many of Iraq's Shi'ite parties, whose ministers voted in favor of the pact Sunday in what may be a signal that they are willing to balance their ties with the Americans and their longtime supporters in Teheran. The Shi'ite, Kurdish and Sunni parties making up al-Maliki's government dominate parliament, and their lawmakers are expected to follow the example of their ministers. Followers of Shi'ite leader Muqtada al-Sadr protested Sunday's vote. "This agreement hands Iraq over (to the United States) on a golden platter and for an indefinite period," said Ahmed al-Massoudi, spokesman for the 30-seat Sadrist bloc in parliament. Al-Sadr, whose militiamen fought US forces in three uprisings since 2003, has threatened to resume attacks on US forces if they don't immediately begin to withdraw from Iraq. The Cabinet vote came a day after the country's most influential Shi'ite cleric, Grand Ayatollah Ali al-Sistani, indicated that he would not object to the pact if it is passed by a comfortable majority in parliament. That cleared a major hurdle to the agreement. The final draft of the agreement, reached after months of negotiations, is designed to meet Iraqi concerns over its sovereignty and its security needs as it continues to grapple with a diminished but persistent insurgency. It provides for the departure of US forces from Iraq by the end of 2011 and gives Iraq the right to try US soldiers and defense contractors in the case of serious crimes committed off-duty and off-base. It also prohibits the US from using Iraqi territory to attack Iraq's neighbors, like Syria and Iran. "The government wanted to make sure that the draft of the agreement safeguards the interests of Iraq and its people, with clear and complete timetables," al-Dabbagh said after the Cabinet's session. "It is not the ideal solution for the Iraqi side or the American side, but conditions on the ground dictated it." Proponents of the security pact with the Americans, including al-Maliki's interior and defense ministers, say a continued US military presence is needed until Iraq's nascent security forces are capable of taking charge of security in the war-devastated nation. Sunday's Cabinet session began shortly after a roadside bomb killed three people and wounded seven in a northern Baghdad district, the latest evidence that violence continues to plague Iraq despite the dramatic improvement in security over the past year. The roadside bomb hit a checkpoint belonging to US-backed fighters in the Sunni enclave of Basatin in the predominantly Shi'ite Shaab district, according to police and hospital officials who spoke on condition of anonymity because they are not authorized to speak to the media. Two of those killed were members of the local Awakening Council, or Sahwa, one of several names used to refer to the Sunni insurgents and tribesmen who have revolted against al-Qaida in Iraq, joining the US military in the fight against the terror group. Five of the injured were also Sahwa members. Sahwa fighters have been frequently targeted by al-Qaida militants since they changed sides in late 2006, with scores of their leaders assassinated and their checkpoints and headquarters bombed.