Libya's defence minister resigned on Tuesday but then changed his mind and the army chief of staff was sacked, as a political crisis deepened over gunmen besieging government ministries.
"I find myself compelled, despite opposition from my colleagues in recent days, to present (my resignation) voluntarily and without hesitation," Mohammed al-Barghathi said, quoted by the official Lana news agency.
"I cannot accept the policy of force used by armed groups in our new state," he added.
But just hours later, the government issued a statement saying Barghathi had changed his mind after Prime Minister Ali Zeidan asked him to stay on.
"The chief of the government asked the defence minister to rescind (his decision) and the minister said he understands, given the circumstances the country is going through, that he should continue in office," a statement said.
Separately, members of the National General Congress (NGC), said it had sacked army chief of staff General Yusef al-Mangoush, who has long been accused of delaying the formation of a proper army.
Other deputies said Mangoush would stay on for another month until a replacement is named.
Militiamen, mostly former rebels who fought to oust Moamer Kadhafi in 2011, have surrounded the justice and foreign ministries since last week to demand the removal from public posts of former officials of the slain dictator's regime.
Initially, the gunmen intended to pressure the NGC, the highest authority in the country, to adopt the law on political exclusion.
But they remained camped outside the ministries despite the adoption of the legislation, with some of them now calling for the resignation of Zeidan's government.
Signup to our newsletter and follow us on Facebook and Twitter!
On Tuesday, a dozen vehicles armed with anti-aircraft guns and rocket-launchers were still parked in front of the foreign ministry, an AFP correspondent reported from the site.
"We are thuwars (revolutionaries) and we want to correct the process of the revolution," said one of the gunmen who identified himself as Mohamed Ben Neema.
"The employees and officials of the former regime who massacred the Libyan people continue to occupy important positions, especially the foreign ministry. The revolution has not come to this building."
Most of the gunmen had left the justice ministry, although five men in military fatigues posing as former rebels were still milling around the building's closed front door.
"We ended our protest. After the adoption of the law on political exclusion, we reached our goal. We just expect a ministry official to formally enter the building," said one of them.
Questioned by AFP, Justice Minister Salah al-Marghani said officials from his department would not return to work "as weapons are still there."
Marghani added that "if this siege continues, we will study the possibility of moving the department to another district or another more secure city".
The controversial law passed by the GNC is expected to take effect within a month.
Some politicians and observers accused Islamists of being behind the armed protests, saying they are aimed at driving more liberal opponents from office.
For example, members of the National Forces Alliance of former prime minister Mahmud Jibril and the largest bloc in the GNC, said the new law was aimed in part at excluding people like him.
Jibril, who served for several years under Kadhafi in the field of economic planning and development, was the first prime minister after the dictator was ousted.