Libya's defense minister on Tuesday rescinded his decision to resign in protest over the continuous show of force by militias that stormed government buildings in what Mohammed Al-Barghathi described as an "assault on democracy and elected authorities."

Libyan state news agency LANA quoted Al-Barghathi as saying that he withdrew his resignation based on a request from Prime Minister Ali Zidan.

Al-Barghathi told reporters earlier that he had decided to resign after militias stormed several ministries and surrounded others with trucks mounted with anti-aircraft guns. Al-Barghathi said he also submitted his resignation over how militias pressured parliament to pass a contentious and sweeping law that bans anyone who served as a senior official under ousted leader Moammar Gadhafi from working in government. Ousting elected officials could further stall the country's already rocky transition to democracy.

"The moment of courage has come and I find myself forced ... to announce my resignation voluntarily and without hesitation," he said at a news conference in the Libyan capital, Tripoli. "I came to this post as a revolutionary and I pledged not to battle the sons of my nation."

The so-called Political Isolation Law could lead to the dismissal of many current leaders, some of whom had defected to the rebel side during the country's 2011 civil war or had been elected to office since Gadhafi's ouster and killing.

Al-Barghathi himself could be affected by the law because he was a military attaché under Gadhafi along with the head of parliament Mohammed al-Megarif.

A number of Libyan militias refused to back down from protests they staged for more than a week outside government buildings, despite passage of the law on Sunday. Militiamen remained outside the Foreign Ministry where several signs demanded the resignation of the prime minister.

Most militias have roots in the rebel groups that fought ousted Libyan dictator Gadhafi in the country's eight-month civil war, but their numbers have mushroomed in the more than a year since his fall. Some militias have been accused of rights abuses, but the government continues to rely on them for security in the absence of a strong police or military.

For months after Gadhafi's ouster, militias protected Tripoli's international airport, provided border security and ensured the country did not spiral out of control.

However, those flexing their muscles appear to be a mixture of militia groups with different motivations, according to lawmaker Tawfiq Breik, from the liberal-leaning National Forces Alliance bloc in parliament.

One group comprises former rebels who fought Gadhafi forces and want to see his loyalists out of government. A second group driven by personal interests is made up of people who either failed in the country's general elections last year or demanded government posts but didn't get them. A third group, Breik said, is the most politicized and wants to see Zidan and his liberal allies out of power.

In their latest show of lawlessness, gunmen stormed the state-owned electric agency and beat up the director, LANA reported. The attack forced the closure of the agency after workers denounced the incident and said that they would not be able to resume work without security.

Meanwhile, rivals to militias of mostly military commanders are waging a campaign against the country's chief of staff Youssef Mangoush whom they accuse of being behind continuous weakness of the state army. On Tuesday, lawmaker Mohammed Zayed posted on his official Facebook page that the parliament had voted to remove Mangoush and gave a defense committee a month to find a replacement.