WASHINGTON — The U.S. military has ordered the amphibious assault ship USS Bataan, with 1,000 Marines on board, to move toward the Libyan coast, the Pentagon confirmed Wednesday, a day after American officials urged citizens to leave the restive country immediately.

As fighting escalated Wednesday between Islamic extremists and rogue nationalist former Gen. Khalifa Hifter and his forces, the move suggested that the United States was preparing for a possible evacuation of U.S. personnel at the embassy in Tripoli or citizens living in Libya. On Tuesday, the State Department warned Americans not to travel to Libya and said those already there should leave.

“Because of the presumption that foreigners, especially U.S. citizens, in Libya may be associated with the U.S. government or U.S. NGO’s, travelers should be aware that they may be targeted for kidnapping, violent attacks or death,” the warning said, referring to nongovernmental organizations. “U.S. citizens currently in Libya should exercise extreme caution and depart immediately.”

That warning came as the leader of Ansar al Shariah, the militant group suspected in the 2012 attack in Benghazi that killed U.S. Ambassador Christopher Stevens along with three other Americans, warned that if the United States got involved in the brewing civil war, it would face a fight “much worse” than Iraq and Afghanistan.

“We remind America, if they intervene, of their defeats in Afghanistan, Iraq and Somalia, because they would face in Libya something much worse,” Mohamed Zahawi, the head of Ansar al Shariah’s Benghazi brigade, said in a statement Tuesday.

The State Department has said there are no planned evacuations of the embassy, which already is operating with a minimal staff. In announcing that 1,000 Marines from the 22nd Marine Expeditionary Unit, based at Camp Lejeune, N.C., would be positioned off the Libyan coast, Pentagon officials stressed that they were there not for a specific mission but “to address unrest in the region.” U.S. officials said the Bataan would reach the north African coast within days but they didn’t offer any specifics.

Earlier this month, the U.S. military moved 200 Marines to Sicily in case of an evacuation, U.S. officials told McClatchy.

For the past two weeks, Hifter, who was a general in the army of the late Libyan leader Moammar Gadhafi, has been leading a military campaign against Ansar al Shariah and other Islamist militias in eastern Libya. The offensive began without government approval, but Hifter, who lived in northern Virginia for 24 years after defecting from the Libyan army, has been able to count on major Libyan military units, including the air force and the country’s special operations commandos.

Hifter has said he’s carrying out the wishes of a population exhausted from months of violence and assassinations perpetrated by the Islamists.

The United States said last week that it wasn’t assisting Hifter and didn’t condone his actions, but it also hasn’t denounced them. The Libyan government declared a no-fly zone over Benghazi and said it had ordered its forces not to support Hifter’s efforts.

On Wednesday, two warplanes apparently loyal to Hifter attacked bases in Benghazi belonging to Ansar al Shariah and the 17th of February militia, the group that was guarding the U.S. diplomatic mission in Benghazi the night the Americans died. There were no immediate reports of deaths or injuries in the air attack.

Hifter’s offensive has spurred militiamen, military commanders and rogue fighters alike to pick sides in what could be a nationwide battle every bit as violent as the one that ended in Gadhafi’s death in 2011. On one side are the Islamists, who want to maintain their hold over Libya. On the other are Hifter’s allies, who want a new political order and a return to stability, even if it means an end to the gridlocked elected government.

Libya’s collapse has been particularly embarrassing for the Obama administration, which three years ago held up its support for a NATO-led air campaign and the subsequent fall of Gadhafi as an example of successful limited intervention. These days, the democratically elected government controls little around it, and many Libyans said they welcomed Hifter’s efforts, however unilateral, if they would restore order and weaken the Islamists’ hold on the country.

