Two people were shot dead when Libyan border guards opened fire to disperse hundreds of Egyptians trying to cross into Tunisia to flee Libya's growing chaos, the Tunisian state news agency TAP said.

Hundreds of Libyan families and foreign workers have fled their homes after two weeks of clashes between rival Libyan militias over Tripoli's airport in the worst violence since the 2011 war to oust Muammar Gaddafi.

Most Libyan airports are closed because of deteriorating security in Tripoli and Benghazi, leaving Tunisia's border one of the few routes out for residents and foreign workers fleeing bloodshed in the capital.

The Philippines has dispatched its foreign secretary to oversee the evacuation of 13,000 citizens from Libya after a Filipino construction worker was beheaded and a nurse gang-raped there.

Foreign Secretary Albert del Rosario said he was flying to Djerba in Tunisia to "try to convince our people to leave  Libya because the situation there is very dangerous".

The Philippine government ordered a mandatory evacuation after the discovery in Benghazi city of the beheaded remains of a Filipino construction worker.

On Wednesday a Filipina nurse was abducted by a gang of youths outside her residence in the capital Tripoli, then taken elsewhere where she was gang-raped by up to six suspects.

The incident involving the Egyptians happened as they protested at the border point of Ras Jdir when the Tunisian border guards closed its gates.

"The incident came after Libyan troops fired to disperse the Egyptians," TAP said, citing Tunisian security sources, who said the two victims had been shot.

There was no immediate comment from the Libyan authorities.

Neighbours Tunisia, Algerian and Egypt are all concerned about violent spillover from Libya's growing chaos involving clashes between rival militia factions and also Islamist militants and the armed forces.

Tunisia said on Wednesday it might close its frontiers with Libya if the security situation keeps worsening.

"The situation is still under control, around 5,000 to 6,000 peoples are crossing every day, but we need to be careful," Tunisian Foreign Minister Mohamed Hamdi told reporters.

Tunisia is increasingly worried about border security as it struggles with the rise of Islamist militants benefiting from the chaos in North African countries such as Libya and Mali.

Earlier this month, 15 Tunisian soldiers were killed when dozens of gunmen with rocket-propelled grenades attacked two checkpoints in Chaambi near Algeria's border, one of the deadliest strikes against Tunisia's armed forces.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.