Gunmen have attacked the home of Libya's new prime minister, as the growing security concerns prompted Washington to recommend Americans leave the country "immediately".
Meanwhile, jihadist group Ansar al-Sharia, targeted by an ex-general who says the country has become a "terrorist hub," has called on Libyans to repudiate him.
Businessman Ahmed Miitig, 42, was elected prime minister this month in a chaotic vote by the General National Congress (GNC) to replace Abdullah al-Thani, who resigned in April after claiming he and his family had been attacked.
An aide to Miitig said "there was an attack with rockets and small arms on the prime minister's house" in Tripoli at 3.00am (1100 AEST) on Tuesday.
The premier and his family were in the house at the time, but escaped unharmed.
His guards opened fire on the group, wounding and arresting two of them, the official added.
In Washington, the US State Department recommended Americans in Libya "depart immediately", in its latest travel warning.
The warning comes amid worsening unrest in Libya, where militia battles have plunged the country into chaos.
"Due to security concerns, the Department of State has limited staffing at Embassy Tripoli and is only able to offer very limited emergency services to US citizens in Libya," the travel warning said.
"Because of the presumption that foreigners, especially US citizens, in Libya may be associated with the US government or US NGOs, travellers should be aware that they may be targeted for kidnapping, violent attacks, or death," it added.
"US citizens currently in Libya should exercise extreme caution and depart immediately," it said.
Earlier on Tuesday, the US announced it was deploying an amphibious assault ship with about 1000 marines off the coast of Libya in case the US embassy must be evacuated.
The USS Bataan was to be in the area "in a matter of days", said a defence official, who spoke on condition of anonymity, adding it was a "precautionary" measure.
The precautions come amid ongoing controversy over a September 2012 attack on the US consulate in Benghazi in which four Americans, including ambassador Christopher Stevens, were killed.
In addition to the 1000 marines, the Bataan is equipped with several helicopters.
Miitig assumed office to already mounting opposition and with rogue former general Khalif Haftar gathering support for an offensive he launched in the eastern city of Benghazi on May 16.
Near daily attacks blamed on jihadists had been targeting security forces in Benghazi, and several military units have thrown their support behind Haftar.
The GNC has accused Haftar of launching a coup but he said the Libyan people had given him a "mandate" to crush jihadists after thousands of people rallied in his support in Benghazi and Tripoli.
On Tuesday, Ansar al-Sharia chief Mohammed el-Zehawi urged Libyans not to support Haftar, who he claimed "wants to divide us".
Accusing him of being a "new Gaddafi" and an "agent of American intelligence", he affirmed his group's determination to fight the "tyrant".