Libya's General National Congress, under pressure from militiamen, on Sunday voted through a controversial law to exclude former regime officials from public posts in a move that could see the premier removed from office.
Gunmen who had surrounded the foreign and justice ministries, to press for officials from dead dictator Moamer Kadhafi's regime who hold top government jobs to be sacked, welcomed the vote and lifted their siege.
State television broadcast live coverage showing 164 lawmakers in the 200-member GNC vote in favour of the law, with just four deputies present voting against.
Under the law, all those who held key official posts from September 1, 1969 when Kadhafi took power, until the fall of his regime in October 2011 will be excluded from government.
The ban will remain in force for 10 years, according to the text.
The draft law had caused a stir among Libya's political elite, as senior members of the government could be affected, among them Prime Minister Ali Zeidan and GNC president Mohamed Megaryef.
Both were diplomats under Kadhafi before joining the opposition in exile.
At least four ministers and 15 lawmakers also risk loosing their jobs once the GNC's legal commission ratifies the law, including the vice president of the national assembly Jomaa Atiga, an official said.
"It is too early to speak of excluding Mr Megaryef. The situation will be clearer in a week or 10 days," a source close to the GNC president told AFP.
He suggested there could be some "amendments" to the law.
GNC spokesman Omar Hmeidan said the law will be enforced one month after its adoption, but he stressed it was too soon to speculate on who will be affected.
Megaryef, who was ambassador to India in the 1980s, was not present for the vote and sent the GNC a letter saying he would stay away to avoid "embarrassing" the lawmakers as they cast their ballots.
A special commission will now be set up to implement the new law which also affects former government ministers, ambassadors, security officers as well as state media officials, public university professors and union leaders.
The gunmen, many former rebels who helped topple Kadhafi, had encircled the foreign ministry for a week and the justice ministry since Tuesday to pressure the national assembly to pass the law.
They vowed to stand their ground and expand their action unless their demands were satisfied, and warned against any GNC attempt to make exceptions to allow key individuals to keep their jobs.
Vice president Salah al-Makhzum said last week that a compromise had been reached among the political blocs by adding "exceptions" in the bill in order to retain key individuals.
Before Sunday's vote the GNC, Libya's national assembly and top political body, had debated the law several times without reaching an agreement.
The bill proved particularly controversial with the National Forces Alliance, the liberal coalition that dominated elections in July, who feared it was aimed at their leader Mahmud Jibril who headed an economic council under Kadhafi.
Jibril's political rivals at the Islamist Justice and Construction Front praised the GNC for voting through the law.
"It is a good decision that will ease tension on the streets," party chief Mohammed Sawan said, adding however that he regrets that some officials who had joined the exiled opposition in the 1970s and 1980s will be affected -- a clear reference to Megaryef.
Human Rights Watch warned the GNC in a statement against a hasty vote or being "railroaded" by armed men.
"Libya's long-term prospects for peace and security will be seriously diminished if the congress agrees to nod through this law," said HRW regional director Sarah Leah Whitson.
In April, under pressure from supporters of the law, the GNC amended the provisional constitutional declaration exempting the law from judicial review even before it was voted on.
Zeidan refused to use force to solve the sieges despite criticism from many Libyans who accuse the authorities of being too soft on the rebels.
Since the fall of Kadhafi's regime, militia groups, mostly ex-rebels, have managed border controls, prisons, strategic facilities and vital institutions.
They received salaries and other perks from the authorities, in addition to reportedly benefiting from smuggling and extortion.
Leaders of the ex-rebel militias said on Saturday the government had agreed to give five ministries over to their members.