Bargathi said on national television Tuesday that guerrilla forces had waged "an assault on democracy." He said he was resigning because he couldn't serve a government controlled by gunmen, the independent Libya Herald reports.
Gunmen stormed government buildings last month and ministerial buildings were stormed this week. The Libyan report said Bargathi was frustrated that Prime Minister Ali Zeidan was apparently negotiating with militia leaders over possible government positions.
Defense Ministry spokesman Adel Barrasi told the newspaper Bargathi resigned out of frustration with the influence that militias had nearly two years after Moammar Gadhafi's regime collapsed during civil war.
Barrasi said the resignation had nothing to do with a law passed last weekend that bars former regime officials for holding political office.
Militias said in April they occupied some ministerial buildings to pressure the government to prevent Gadhafi-era authorities from holding office.
Zeidan and some other high-ranking officials served in Gadhafi's government. Human Rights Watch said the law restricting their service was too vague.
Notable deaths of 2014 [PHOTOS]