It is the second time in more than three years that the US has closed its embassy in Libya.

Turkey has also withdrawn some 700 members of staff from Libya, Secretary of State John Kerry said.

Earlier this week, the UN also announced it was withdrawing all its staff from Libya.

Warning

US ambassador Christopher Stevens and three other Americans were killed in an attack on the US consulate in Benghazi in September 2012.

The US move comes one day after Libyan government officials warned of the possibility of a break up of the country if clashes over Tripoli airport continue.

Libyans rallied on Saturday in Tripoli to call for an end to the violence

Rival Libyan militias have been locked in battle at Libya's main airport in the south of Tripoli since last week, forcing the airport to shut.

Members of the Islamist Libya Revolutionaries Operations Room (LROR) are trying to seize control of the airport, which has been in the hands of the Zintan militia since the toppling of Col Muammar Gaddafi in 2011.

Our correspondent in the capital says both militia groups are believed to be on the official payroll.

The government has been unable to disarm the numerous armed groups that took part in the 2011 uprising and which have divided the country.

The eastern city of Benghazi has also been wracked by fighting between a rogue general, Khalifa Haftar, and Islamist groups, while many oil fields remain in the hands of separatist groups.

Dozens of government officials and high-profile military figures have been the target of assassination attempts in the city over the last two years.