Tunisia closed its main border crossing with Libya on Friday after thousands of stranded Egyptian and foreign nationals, fleeing militias' fighting and violence in Libya, tried to break through the passage, the Tunisian news agency said, according to The Associated Press.

It was the second eruption of unrest at the border in as many days, as thousands of Libyans stream into neighboring Tunisia, along with foreign nationals, the AP reported.

Tunisia is the only escape route as fighting escalates in the Libyan capital, Tripoli, where rival militias have been battling for weeks for control over the airport, according to the AP.

Friday's unrest took place when thousands of Egyptians, barred from entering Tunisia because they had no visa, held a protest then broke through part of a fence at the Ras Ajdir crossing, the AP reported.

The police responded by shooting in the air and firing tear gas, according to the AP. The officials spoke on condition of anonymity because they were not authorized to speak to the press.

A day earlier, two Egyptians were killed during a similar protest demanding to be let through, the AP reported. Tunisian officials say thousands of Libyans have been crossing the border each day the past week.

Libya is witnessing its worst factional violence since the downfall of the longtime dictator Moammar Gadhafi in 2011 civil war, according to the AP. Along with the fighting in Tripoli, which the Health Ministry said has killed 214 people and wounding more than 980 others, Islamic militias the past week overran army bases in Libya's second largest city, Benghazi, and claimed control of the city.

Earlier Friday, a powerful explosion ripped through the main police headquarters in Benghazi, nearly flattening it, witnesses said, the AP reported. The blast shook nearby houses and echoed across the eastern city.