BAGHDAD - Iraq's fractious parliament squeezed its abrasive speaker out of a job Tuesday and authorized non-U.S. foreign troops to stay in the country for another half-year in a couple of high-stakes moves in its final session of 2008.

The resignation of Sunni speaker Mahmoud al-Mashhadani capped a long-running power struggle with Shiite and Kurdish deputies and even members of his own party.

Legislators applauded his announcement, quickly approved it, then passed a measure allowing Britain's 4,000 troops and several smaller contingents from other countries to stay through July.

"I do believe that I was faithful to doing good work," al-Mashhadani said in his address to the chamber, where his arbasive style often offended other legislators. "If I caused hurt to you, I ask your forgiveness."

The authorization for foreign troops became entangled in al-Mashhadani's quarrel with Kurdish and Shiite deputies last week, when he shouted insults at some of them and threatened to resign because "there is no honour in leading this parliament."

His opponents ultimately forced him to keep his word. As a negotiating ploy, al-Mashhadani tried to delay until Jan. 7 the vote on the troops resolution -- a week after the Dec. 31 expiration of the UN mandate authorizing the presence of foreign troops in Iraq.

The new measure will allow non-U.S. military personnel to stay through and assist American soldiers until the end of July. The Americans can remain until the end of 2011 under a separate security agreement.

Britain has already said it plans to withdraw its 4,000 troops from southern Iraq by the end of May. Australia, El Salvador, Estonia and Romania also have troops in Iraq but much smaller contingents.

Al-Mashhadani has long been at the centre of arguments in the legislature because of his erratic behaviour and abusive language.

Two years ago, the Shiite bloc ousted al-Mashhadani after a string of outbursts, but his fellow Sunnis forced his reinstatement. Al-Mashhadani also clashed with Kurdish legislators earlier this year in a dispute over the oil-rich city of Kirkuk.

Al-Mashhadani told legislators in behind-the-scenes negotiations that in return for his resignation he wanted to be named head of a human rights association, Shiite deputy Reda Jawad Taqi told The Associated Press before Tuesday's session convened.

The speaker also wanted a guarantee that his post would be filled by someone from a party other than his own Sunni Iraqi Islamic party, with which he is also feuding, Taqi said. The speaker's post is usually held by a Sunni and there are a number of Sunni parties in parliament.

It was not clear if the Parliament agreed to the concessions.

The speaker will be temporarily replaced by one of his two subordinates. The main Sunni party will then choose a replacement after parliament convenes following Christmas and a number of Islamic holidays.

Also Tuesday, nearly two dozen police and security officials allegedly arrested on suspicion of forging identity cards and badges were released on bail, security officials said.

The men originally were reported to have been arrested for conspiring to restore Saddam Hussein's outlawed Baath party and planning a coup. But the government subsequently denied there was any conspiracy.

The security officials said those arrested were released while an investigation proceeds, without specifying whether they will be charged.

Elsewhere in Iraq, four policemen were killed and three others injured in bomb explosion in Tarmiyah, 50 kilometres north of Baghdad, police said.

The U.S. military said four policemen and one civilian were killed in the incident. Conflicting information on attacks in Iraq is common.