BAGHDAD // Iraq's parliament approved today a security pact with the United States that lets American troops stay in the country for three more years, setting a clear timetable for a US exit for the first time since the 2003 invasion. The vote in favour of the pact was backed by the ruling coalition's Shiite and Kurdish blocs as well as the largest Sunni Arab bloc, which had demanded concessions for supporting the deal. The haggling among the political factions highlighted sectarian-based tensions that hinder reconciliation efforts, nearly six years after Saddam Hussein's ouster. The Shiite bloc agreed to a Sunni demand that the pact be put to a referendum by July 30, meaning the deal must undergo an additional hurdle next year. It took nine months of difficult talks for US and Iraqi negotiators to craft the agreement. Under the agreement, US forces will withdraw from Iraqi cities by June 30 and the entire country by Jan 2012. Iraq will have strict oversight over US forces. Lawmakers voted with a show of hands, and an exact breakdown of the parliamentary vote was not immediately available. But parliament speaker Mahmoud al Mashhadani said an "overwhelming majority" of lawmakers who attended the session voted in favour. Parliament's secretariat, which counted lawmakers as they entered the chamber, said 220 out of 275 legislators attended. "This is a historic day for parliament," said the deputy speaker Khalid al Attiyah, a close ally of the prime minister Nouri al Maliki. "More than three-quarters of those present at today's session voted for the agreement, and that was not expected." Mr al Maliki appeared to have won the comfortable majority that he sought in order to give the agreement additional legitimacy. The country's most influential Shiite cleric, Grand Ayatollah Ali al Sistani, had indicated that the deal would be acceptable only if passed by a comfortable majority. A government spokesman Ali al Dabbagh urged those who opposed the agreement to accept the decision by the parliament. "Iraqis should now feel that they have the control and they have to take the full responsibility" for security, he told Associated Press Television News. "Even those who reject this share the responsibility in order to reform the country and in order to stabilise the country."