The US is sending 1,000 Marines in an amphibious assault ship to Libya's coast as a “precautionary” move should the US embassy require evacuation, a US official said. Security concerns also led the US to suggest Americans in Libya "depart immediately."

Adding to tensions, gunmen attacked the Tripoli home of Libya’s new prime minister, Ahmed Maiteeq, on Tuesday. Businessman Maiteeq, 42, and his family escaped harm, according to AFP.

An aide to Maiteeq said "there was an attack with rockets and small arms on the prime minister's house" in Tripoli at 3:00 a.m. (0100 GMT). Maiteeq’s guards opened fire on the attackers, wounding and arresting two of them, the official added.

In reaction to the heightened strife in Libya, the USS Bataan, stocked with several helicopters in addition to the Marines, is to be in the nation’s coastal area “in a matter of days,” an anonymous US defense official said, according to AFP.

The preemptive move is a reaction to increasingly violent militia battles, which could threaten the American embassy’s security, the official said.

Based on escalating security concerns, the US State Department recommended Tuesday that Americans in Libya "depart immediately."

"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.

The US also has 250 available Marines, seven Osprey combat aircraft, and three refueling aircraft in Sigonella, Italy, AFP reported.

The State Department said last week that its embassy in Tripoli was operating as usual despite offensives launched by a dissident general, Khalifa Haftar, against the Libyan parliament and Islamist factions.

Meanwhile, Mohamed Zahawi, the head of Libya’s Ansar Al-Sharia militant group in Benghazi, warned against any US interference in the nation’s ongoing tumult.

Zahawi accused the US government of backing General Haftar, a "new Gaddafi," and an "agent of American intelligence.”

“We remind America, if they intervene, of their defeats in Afghanistan, Iraq and Somalia, because they would face in Libya something much worse," he said in a statement on Tuesday. "It was America who urged Haftar to turn the country towards war and bloodshed."

The State Department has denied any role in Haftar’s recent offensives despite accusations that the US is encouraging the senior military official. Haftar previously spent decades in the US before returning to Libya in 2011 to join rebels fighting the regime of then-president Muammar Gaddafi.

Following the ouster of Gaddafi in 2011, militias in a destabilized Libya expanded in numbers, both exploiting and filling in the security gap while the nation struggled with weak military and police forces.

Libya's parliament remains split by rivalries, with little democratic reforms made since 2011. The country is now under the rule of its third prime minister since March, and a new constitution is still not ready.

Maiteeq, who is backed by Islamists in parliament, was chosen as the new premier this month in a chaotic vote by the General National Congress. He replaced Abdullah Al-Thani, who resigned in April after claiming he and his family were the target of attacks.

Maiteeq has invited opponents to join a "comprehensive national dialogue to complete state institutions,” though he has also said he is committed to "pressing the battle against terrorists and those who threaten the security of the country," a nod to eastern militants, some of whom are blockading oil terminals in the region.