With a bomb on the runway, pets boarding planes and passengers jetting off without visas, Tripoli International Airport typifies the chaos that has gripped Libya since the 2011 ouster of Moammar Gadhafi.
Western powers and Libya's neighbors worry the capital city's airport could be a gateway for illegal immigrants, including militant Islamists, from Africa and conflict zones such as Syria.
Morocco has just introduced visa requirements for Libyans after one group of travelers arrived on forged Libyan passports, and some European and Arab airlines have stopped flying to Tripoli for security reasons.
The European Union is training officials and helping upgrade facilities at the aging airport, a former British military base from World War II, but a few new luggage scanners won't address the underlying security problem - a government that is struggling to impose its authority on a country awash with arms and militias.
Like much of the North African country, the area surrounding the airport is controlled by one of the dozens of brigades of rebels that helped overthrow Gadhafi and have refused to give up their arms.
Political analyst Salah Elbakhoush said the airport was in the middle of a power struggle, with other armed groups, residents and civil aviation staff challenging the control of the militia from Zintan in western Libya.
“People are fed up with them,” he said. “The situation west of Tripoli (near the terminal) ... is very dangerous. The government is too weak to do anything.”
Nightly shootouts have become more frequent in the area, making the airport road one of the most dangerous places in the capital, where security has deteriorated in recent months.
Whoever controls the airport, located about 30 kilometers (18 miles) outside Tripoli, gets access to business at the terminal, which is a main cargo and smuggling hub.
Diplomats say the struggle between militias explains a bomb explosion on the main runway in March. An unknown group has claimed responsibility for the attack on social media, though the government has not said who was behind it.
“The device was planted at 05.30 a.m. when there was no traffic, to avoid any casualties but to probably show the Zintanis are unable to provide security,” said a Western diplomat.
The interim government is trying hard to boost airport security, but its nascent security forces are still in training, and the loyalty of some is questionable.
Security staff include former police officers from the Gadhafi era along with newcomers from civil war militias integrated by the government to get them off the streets.
They wear official uniforms but in practice sometimes report to their militia commanders, tribes or families. “You cannot walk into the airport perimeter, plant a bomb on the runway and fire it from outside by remote control without some people looking the other way for some time,” said another diplomat.
Experts say the airport has nevertheless come a long way since the immediate aftermath of the NATO-backed uprising in 2011, when anyone could walk into supposedly controlled areas.
The EU Border Assistance Mission
(EUBAM) and foreign airlines are focusing on small steps to improve security such as more efficient passport controls and better organization of the terminal.
The airport has introduced security zones requiring passes to regulate access to the most sensitive areas near the gates, said its security chief Taha Mahmoudi.
“We have made a lot of progress in the 18 months,” he said, though limited space at the small terminal handling both international and domestic flights remained a challenge.
Imposing order is no easy matter. Those coming to greet friends and relatives often walk past officers into restricted areas such as baggage reclaim or even up to passport control on the first floor.
Passport officers, some dressed in uniforms for different services, others in civilian clothes, have computers at their booths but rarely use them because most never had proper training, security experts say.
EUBAM trainer Andrew Lyttle said officers were still good at spotting forged Libyan passports or Egyptian workers arriving on fake Libyans visas, their main areas of concern.
“They even once caught me because my papers were not in order,” said Lyttle, who trains airport officers on the job.
Officials also hope a new electronic passport being rolled out will end a thriving illicit trade in Libyan travel documents. The current passports are handwritten and easy to forge.
Still, Western diplomats and security experts have no illusions about the challenges, describing airport security as a “nightmare” or “disaster”.
“The Libyans basically don't know who is entering or leaving their country,” said one Western diplomat.
Even if luggage or passport checks were enforced, the equipment is not up to the task.
“The present scanners have no explosive detection systems,” said Jean Assice, a French civil aviation engineer whose firm represents nine European and American security equipment manufacturers active in Libya.
“The luggage surveillance is out of date, the video surveillance system is out of date,” Assice said. “Ninety percent of the cargo is not controlled.”
Germany's Lufthansa and Austrian Airlines have halted flights, handing over lucrative business - a return flight costs up to $1,000 thanks to a risk premium from Tripoli to, say, London or Frankfurt - to more intrepid carriers such as Turkish Airlines, which has increased flights.
Abu Dhabi-based Etihad stopped flying in November, saying “the existing situation at Tripoli airport does not provide the level of assurance we require to ensure safe operation of our flights”.
Officials see it as a success that British Airways and Alitalia decided to resume flights after weeks of interruption following the runway bomb.
Authorities have promised more dog patrols at the perimeter to better protect the runway, while the European airlines already get a little more space for their own staff to conduct extra luggage checks.
The European carriers arrive in the early afternoon, a time when a maximum number of airport staff are on duty and the city is often quiet - shootings tend to happen after sunset.
There are also more Libyan officials visible at the check-in counters to verify travel documents after European governments complained people had been allowed to board illegally without visas, while others had brought banned pets.
“We have been focusing on the weak points,” said airport security chief Mahmoudi. “The airport is old, space is limited. We're trying to make the most of what we have.”