Rival armed groups fighting for control of the international airport in the Libyan capital of Tripoli have agreed to a temporary ceasefire as a Muslim Brotherhood leader described attacks by armed groups on the facility as "legitimate”.

The weeks-old battle for Tripoli's airport has killed dozens and nearly destroyed the facility. Shelling sparked a giant fire that continues to burn out of control in nearby oil tanks.

Two brigades of former rebels, mainly allied to the towns of Zintan and Misrata, have pounded each other's positions in Tripoli with rockets, artillery and cannon fire, turning the south of the capital into a battlefield.

Many mediators have succeeded in convincing the militias to stop fighting, at least temporarily

- Ahmed Lamin, the Libyan government spokesman.,

Except for sporadic shelling away from the ceasefire zone around the fire near the capital's international airport, Wednesday was a quiet day in the capital Tripoli.

"Many mediators have succeeded in convincing the militias to stop fighting, at least temporarily," government spokesman Ahmed Lamin said.

"They are trying to get them to the negotiating table, we hope they will agree."

The leader of the Muslim Brotherhood's political arm in Libya told the AP news agency that an attack by armed groups on the capital's airport was a “legitimate'' response to an offensive by a renegade general against fighters.

The comments by Mohammed Sawan on Wednesday were apparently a show of support for groups trying to wrest control of the airport from rival fighters.

Sawan said the assault was in response to a months-long offensive by General Khalifa Haftar, who has being trying to crush extremist militias in Libya, mainly in the eastern city of Benghazi.

After heavy fighting in the capital, most Western governments have followed the US and UN pulling their diplomats out of the North African country.

The French government said it had temporarily closed its embassy on Wednesday, and evacuated 30 French nationals from Tripoli just a few days after the US embassy evacuated its staff under heavy military escort across the Tunisian border.

At least 75 bodies, mostly soldiers, have reportedly been found in the eastern Libyan city of Benghazi after two days of violence in which fighters with al-Qaeda linked Ansar al-Sharia and its allies overran an army base.

The Red Crescent found more than 50 bodies inside the base, which special forces abandoned on Tuesday. Sources in the city's hospitals told Reuters news agency that they had received at least 25 other bodies.

'Tunisia might close border'

As the fighting continued, Tunisia said it could not cope with any massive influx of refugees who might seek to enter the country from neighbouring Libya and would close its border if necessary.

"Our country's economic situation is precarious, and we cannot cope with hundreds of thousands of refugees," Mongi Hamdi, the foreign minister, told a press conference.

"We will close the border if the national interest requires it."

Scores of people have fled to Tunisia from Libya following the recent violence.

Libya has suffered from chronic insecurity since former leader Muammar Gaddafi was overthrown in 2011. The new Libyan government has been unable to rein in the militias that helped to overthrow him and other fighters.

Source: Agencies