Libya's flag flutters as security forces gather in Tripoli in September 2013 in preparation for a crackdown on crime and criminal groups around the city. Mahmud Turika/AFP/Getty Images

Gunmen killed Libya's deputy industry minister as he drove home from a shopping trip in the city of Sirte during the weekend, in an attack officials blamed on hard-line militants.

Libya is still plagued by violence and assassinations more than two years after civil war ousted longtime leader Muammar Gaddafi. Militias and former opposition fighters often resort to force to impose demands on the fragile government.

Deputy Industry Minister Hassan al Drowi was shot several times late Saturday, said a senior security official who asked not to be identified.

"They opened fire from another car while he was driving. He was shot multiple times," the official said. "Later, they found explosives attached to his car. The theory is, the bomb failed, so they shot him instead."

The official blamed hard-line fighters who have been trying to extend their influence in the coastal city of Sirte, which has been more stable recently than the capital, Tripoli, or the major eastern city of Benghazi.

Sirte was the last bastion of Gaddafi loyalists in the war, and he was killed there on Oct. 20, 2011.

Prime Minister Ali Zeidan's central government, weakened by infighting and with only nascent armed forces, is struggling to wrest back control in areas where militias are still dominant.