Libya's parliament has voted to ban anyone who held a senior position during Muammar Gaddafi's 42-year rule from government, a move which could unseat the prime minister and other top officials regardless of their part in toppling the dictator.
Politicians debated the draft law for months, but the issue came to a head this week when heavily armed groups took control of two ministries and stormed other institutions including the state broadcaster.
The decision to hold the vote under duress could embolden the armed groups to use force again to assert their will over parliament.
Prime Minister Ali Zeidan, a diplomat under Gaddafi who defected to the exiled opposition in 1980, could be among those barred from office, although this remained unclear and a parliament spokesman said it would be decided by a committee charged with implementing the law.
"Being unjust to a few is better than defeating the whole objective of the law," said one of the hundreds who filled Tripoli's main square to celebrating the passage of the law, many of them shooting guns into the air.
Nearly two years after Gaddafi was overthrown, the fighters who fought to end his 42-year dictatorship are refusing to lay down their arms and go back to civilian life - militia members are more visible than Libyan state forces in the capital.
The cabinet and Libya's official armed forces are so weak that swathes of the oil-producing desert country remain outside central government control.
A spokesman for parliament admitted it was unclear whether the vote would be enough to dislodge the armed men from their positions outside the government buildings.
"We hope the siege of the ministries will stop now, but it is not in our hands," Omar Hmaiden, General National Congress spokesman, said after the vote.
More than a dozen vehicles mounted with anti-aircraft weapons and machine guns remained parked outside the justice ministry, and the foreign ministry has been similarly encircled for a week.
One of the men stationed by a machine gun in front of the justice ministry said the group came from different areas close to the capital Tripoli, and ahead of the vote vowed they would stay until the prime minister had been forced from office.
"We have been asking them to deal with Gaddafi's friends for a year," he said.
Former officials barred
The law prohibits former officials from holding any position in government or even belonging to a political party.
It will also ban them from leadership roles in the country's state firms, like the National Oil Corporation, its universities and judicial bodies.
Although the law passed with an overwhelming majority of 164 votes in favour and just four against, many congress members were upset.
"It's a very unfair and extreme law, but we need to put national interests first in order to solve the crisis," said Tawfiq Breik, spokesman for the liberal National Forces Alliance bloc, Libya's largest parliamentary coalition.
Diplomats in Tripoli complained that holding the vote under duress had undermined its legitimacy, while a human rights group called on parliament to reject the draft.
Congress members say the law could be applied to around 40 others in the 200-member parliament, including Mohammed Magarief, president of the assembly, who became an exiled leader of Libya's oldest opposition movement in the 1980s after serving as an ambassador under Gaddafi.