BAGHDAD, Iraq (CNN) -- After months of tough negotiations and intense political wrangling, Iraqi lawmakers Thursday approved the U.S.-Iraqi security agreement, a pact that allows the presence of American troops in Iraq for three more years.
Iraqis in a coffee shop watch the Iraqi parliament on television on Thursday.
The vote -- which now needs unanimous ratification from the country's three-member presidency council -- comes after a compromise on a reform package that Sunni Arab politicians demanded in return for their backing of the agreement.
There were 198 lawmakers from the 275-member parliament present for the vote; 149 of them voted for the security pact, which is to replace a U.N. mandate that expires at the end of year.
The proposal, reached after months of negotiations between Iraqi and U.S. representatives, sets June 30, 2009, as the deadline for U.S. combat troops to withdraw from all Iraqi cities and towns. The date for all U.S. troops to leave Iraq would be December 31, 2011.
The agreement -- which stresses respect for Iraqi sovereignty -- "requests the temporary assistance" of U.S. forces, but severely restricts their role.
It says that all military operations are to be carried out with the agreement of Iraq and must be "fully coordinated" with Iraqis. A Joint Military Operations Coordination Committee would oversee military operations.
Iraq has the "primary right to exercise jurisdiction" over U.S. forces "for grave premeditated felonies," the agreement says. Suspects would be held by U.S. forces but must be available to Iraqi authorities for investigation or trial. Iraq also would have the "primary right to exercise jurisdiction" over U.S. contractors and their employees.
Also, it says, "Iraqi land, sea and air shouldn't be used as a launching or transit point for attacks against other countries."
Parliament also passed another U.S.-Iraqi bilateral pact called the strategic framework agreement, along with the reform legislation.
Lawmakers also OK'd a referendum on the progress of the security agreement to be held by the end of July.
U.S. Ambassador to Iraq Ryan C. Crocker and Gen. Ray Odierno, the top U.S. military official in Iraq, issued a statement welcoming the passage of the security pact and the strategic framework agreement -- which covers a wide range of bilateral cooperation efforts. The two congratulated the lawmakers and said they look forward to the security pact's ratification by the presidency council.
"Taken together, these two agreements formalize a strong and equal partnership between the United States and Iraq," their statement said. "They provide the means to secure the significant security gains we have achieved together and to deter future aggression.
"They establish a framework for cooperation in the fields of defense, political relations, economics, trade, culture, education, the rule of law, health, the environment and science and technology."
Sunni Arabs were not against the historic security agreement, but they were concerned about Shiite Prime Minister Nuri al-Maliki having too much power when the agreement goes into effect. They wanted legislation that would underscore their constitutional interests and rights.
Although there apparently were enough votes to approve the security pact even without the compromise, al-Maliki's government, as well as Shiite and Kurdish leaders, wanted to work out the political reform deal with the Sunni Arabs so there could be national unity on the security pact.
Asked why the political reform agreement was so important, Alaa Makki, a Sunni parliament member, said, "It gave a message that there will be no dictatorship in Iraq in the coming period and the Iraqi people will say the final word."
The compromise virtually assures the security agreement's ratification by Iraq's presidency council, which consists of Kurdish President Jalal Talabani, Shiite Vice President Adel Abdul Mehdi and Sunni Vice President Tariq al-Hashimi.
Lawmakers loyal to Shiite cleric Muqtada al-Sadr and others had been staunch opponents of the security pact. But there was overwhelming support for the measure from other quarters.
The Sadrists made loud protests against the agreement during the brief parliament session.
CNN's Jomana Karadsheh and Arwa Damon contributed to this report.