The Iraqi parliament has voted to allow the presence of non-US foreign troops after December 31, giving British, Australian and other troops a legal basis to remain beyond the expiry of a UN mandate.
The vote was delayed for several days by squabbling in the parliament, whose speaker, Mahmoud al-Mashhadani, resigned just before the resolution was passed on Tuesday.
"This project got a majority of votes. We authorise the government to take all necessary steps regarding foreign forces other than US forces," Khalid al-Attiya, the deputy parliamentary speaker, said.
Al-Attiya said the measure would allow the troops to stay to the end of July 2009.
Details of the measure were not immediately available, but al-Attiya said it empowered the government of Nuri al-Maliki, the Iraqi prime minister, to permit the troops to stay.
Parliament had rejected on Saturday on technical grounds a draft law that would have allowed the foreign soldiers to do combat operations through May next year and to stay in Iraq through July.
Deputies argued that, rather than legislation, a treaty or agreement was needed, similar in format to a US-Iraqi deal that allows the 140,000 troops in Iraq to remain until 2011.
The US, which supplies 95 per cent of foreign troops in Iraq, has already signed a Status of Forces Agreement with the Baghdad government, under which its combat forces can remain in the country until the end of 2011.
During a visit to Iraq last week, Gordon Brown, the British prime minister, announced that his country's troops would wrap up their mission by the end of May and later said that all but 400 would be out by the end of July.
There are currently 4,100 British troops in Iraq concentrated around Basra airport in the south.
Australia, El Salvador, Estonia and Romania also have small numbers of troops in Iraq.
The parliamentary debate on troop presence on Saturday had been sidelined by the political storm stirred up by comments made by al-Mashhadani.
He had angered many politicians with his brash style and insults in that session.
He finally tendered his resignation on Tuesday and it was accepted by a majority of the deputies attending a closed-door emergency session of the parliament.
Shia and Kurdish politicians had demanded resignation of al-Mashhadani, who is a member of Iraq's largest Sunni bloc.
Speaking to Al Jazeera, Alaa Makki, a Sunni MP, said: "There was a great debate whether he would remain or not, [but] he understood that people didn't want him to stay ... and now we are looking forward to political reform, for a referendum, and for elections.
"All these need a strong parliament with no problems - a parliament with unified views to face these difficult problems."