Gunmen killed two army officers in Benghazi in eastern Libya on Thursday, security sources said, the latest violence in the country's second-largest city despite the deployment of special forces.
A captain was shot dead near a mosque, the sources said, and a former air force officer was also killed.
When Prime Minister Ali Zeidan visited the port city of one million inhabitants on Monday he vowed to make its security "the highest priority of all priorities".
The army deployed special forces across Benghazi one week ago in response to deteriorating security in the past few months. Militants and Islamists roam the city unchallenged, highlighting the instability that continues to afflict Libya two years after the fall of Muammar Gaddafi.
Most countries closed their consulates in Benghazi after a series of attacks and some foreign airlines have stopped flying there. The U.S. ambassador and three other Americans were killed in September 2012 during an Islamist assault on the consulate.
Stability in eastern Libya is key for oil supplies because about 60 percent of Libya's oil production comes from its eastern half.
Western powers also worry that instability in Benghazi will spill over to the capital Tripoli, which last week saw the worst fighting in months between militias.