From the BBC
We were lied into a bullshit war ...
Iraqi parliament backs US pullout
The parliamentary vote was broadcast on Iraqi television
The Iraqi parliament has voted to accept a deal on the future presence of US troops in the country.
The decision, praised by US President George Bush, means US troops will leave Iraqi streets by mid-2009 and will quit Iraq entirely by the end of 2011.
The agreement is the result of a year of negotiations with the US, with the Iraqis requesting several changes.
Some groups fiercely opposed the pact in parliament and at mass rallies, demanding that US troops leave earlier.
Iraq's Presidential Council must still ratify the deal but its approval is expected.
Iraq's government has hailed the parliamentary session as the prelude to the return of full sovereignty to the country.
'No, no, no'
Of the 275 members of parliament, 198 were present, with 149 voting in favour. An initial Iraqi count had put the figure at 144.
US troops continue to patrol the streets of Baghdad and other cities
The chamber saw rowdy scenes of stamping, shouting and the waving of placards during the debate, the BBC's Humphrey Hawksley reports from Baghdad.
After last-minute negotiations that had delayed the vote for a day, MPs passed it on one significant condition: that a referendum is held on the pact in the middle of next year.
If that fails to endorse the withdrawal plan, US troops may have to leave earlier, possibly by the middle of 2010, our correspondent says.
Before the vote, mainstream Shia and Kurdish parties had been able to muster 138 votes between them but had needed support from the minority Sunni MPs in order to create a sense of national consensus.
The Sunnis failed to win concessions on the disbanding of a special tribunal dealing with crimes committed when Saddam Hussein was in power and laws over former members of Saddam's Baath party, who were almost all Sunnis.
While the Sunni parties now support the withdrawal plan, MPs from a hard-line Shia block, the Sadrists, voted against, and while the show of hands was being counted they were on their feet, waving banners and shouting "No, No, No" to the US.
In a statement from Washington, the US president congratulated the Iraqi parliament, saying its vote had affirmed "the growth of Iraq's democracy and increasing ability to secure itself".
"We look forward to a swift approval by Iraq's [Presidential] Council," he added.
Earlier, a joint statement from US Ambassador to Baghdad Ryan Crocker and Gen Ray Odierno, the top commander of US troops in Iraq, said the vote would "formalise a strong and equal partnership".
Speaking before the vote, Iraqi government spokesman Ali al-Dabbagh said its success would constitute a "victory for democracy because the opposition have done their part and the supporters have done their part".
"Everyone should understand that if there are gains, they are for all Iraqis, and if there are losses, they will also be for all Iraqis," he added.
Under the deal, all 150,000 US troops will have left Iraq by the end of 2011.
It was necessary to determine the role of US military forces in Iraq as their UN mandate expires on 31 December of this year.