The Iraqi parliamentary speaker resigned on Tuesday, ending a long-running power struggle and allowing lawmakers to authorize British and other non-U.S. foreign troops to remain in the country into 2009.

Lawmakers applauded with the resignation of Mahmoud al-Mashhadani, a Sunni who has clashed repeatedly with Kurdish and Shiite lawmakers in recent years. The enmity reached its peak last week in a shouting match over the detention of the journalist who threw his shoes at President George W. Bush.

Within a half-hour of his resignation, parliament approved the troops measure in a voice vote — just a week before the U.N. mandate authorizing foreign troops was to expire.

The new measure will allow Britain's 4,000 soldiers and smaller contingents from several other countries to stay through and assist U.S. troops until the end of July. The Americans can remain until the end of 2011 under a separate security agreement.

The authorization for foreign troops became entangled in al-Mashhadani's quarrel with Kurdish and Shiite lawmakers last week, when he hurled abuse during a session and threatened to resign. His opponents ultimately forced him to keep his word. In turn, al-Mashhadani tried to delay until Jan. 7 the vote on the foreign troops resolution — a week after the Dec. 31 expiration of the U.N. mandate.

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 center of arguments in the legislature because of his erratic behavior and abusive language.

He told lawmakers in behind-the-scenes negotiations that in return for his resignation he wants to be named head of a human-rights association, Shiite lawmaker Reda Jawad Taqi told The Associated Press before the session convened. The speaker also wanted a guarantee that his post would be filled by someone from a party other than al-Mashhadani's own Sunni Iraqi Islamic Party, with whom he is also feuding, Taqi said.

The post is usually held by a Sunni and there are a number of Sunni parties in parliament.

The Tuesday session was closed, but al-Mashhadani's resignation announcement and the vote on the troops measure could be heard in the corridors. However, it was not immediately known if the lawmakers agreed to the concessions sought by the speaker in exchange for stepping down.

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

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

Also Tuesday, nearly two dozen police and security officials 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 pending completion of an investigation, without specifying whether they will be charged. The two officials spoke on condition of anonymity because they were not authorized to speak to news media.

Elsewhere in Iraq, four policemen were killed and three others injured in bomb explosion in Tarmiyah, 30 miles north of Baghdad, an officer said on condition of anonymity as he was not authorized to speak to the media.

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