An hours-long hostage drama at an airport on the Mediterranean island of Malta ended peacefully Friday with two hijackers who had threatened to blow up a Libyan passenger jet choosing instead to surrender to authorities. 

Their arrest brought to a close a tense international confrontation that began when the two hijackers — apparently armed with a hand grenade and handguns — commandeered the plane over Libyan skies, then diverted it 300 miles north to Malta.

For hours, Afriqiyah Airways Airbus A320 sat on the runway with 117 people on board while authorities negotiated and camouflage-clad troops lay in wait. 

The hijackers’ surrender came after all of the flight’s passengers had been safely released. In the final moments of the crisis, the flight’s crew walked down the stairs, with at least one hijacker calmly following.

Maltese Prime Minister Joseph Muscat said the men had a hand grenade and a pistol. Another pistol was later found on the aircraft.

A picture taken on Dec. 23, 2016 in Valletta, Malta, shows a group of hostages being released from the Afriqiyah Airways A320 after it was hijacked from Libya. (Matthew Mirabelli/AFP/Getty Images)

It was not clear how the weapons were smuggled aboard in Libya. But Muscat said authorities had managed to steer events away from violence once the plane landed in Malta.

“It was a very good day — no casualties, and people are safe,” a smiling Muscat told reporters.

Muscat said that Maltese authorities had refused to negotiate with the hijackers and insisted that they release their hostages. He said the men had not made specific demands, and their motives were unclear.

In an interview during the standoff with a Libyan broadcaster, Libya Channel, the flight's captain said the two hijackers were in their 30s and were asking for political asylum and for the establishment of a new Libyan party, al-Fateh al-Jadeed. The captain identified the men as Ahmed Ali and Mousa Shaha.

In a separate interview with the broadcaster, Shaha confirmed those demands and said he was in the custody of Maltese authorities. The interview was cut off before he could say more.

Maltese television showed one of the men — well-dressed in a gray suit jacket — waving the green flag of the former regime of Libyan strongman Moammar Gaddafi as he exited the plane. 

The Times of Malta reported that the hijackers claimed to be from a little-known Libyan faction called Fatah al-Gadida, and were backers of the late dictator in a country that has been wracked by internal unrest since Gaddafi’s downfall in 2011. Gaddafi loyalists in Libya, however, insisted that the men were unknown to them.

Friday’s Afriqiyah flight had been scheduled to land in Libya’s capital, Tripoli, and had originated in the southwestern Libyan city of Sabha. The plane was carrying 111 passengers, including 82 men, 28 women and an infant, Muscat said.

The Sabha region is known as a hub for arms smuggling and traffickers taking migrants from Libya and other points in Africa on the journey to the Mediterranean for clandestine ships bound for Europe.

The first signs of a peaceful resolution to Friday’s standoff came just over two hours after the flight landed, when women and children were permitted to disembark. Later, male passengers were also allowed to leave the plane.

Many of the passengers appeared relaxed as they came off the flight. A crew member stood at the top of the stairs, occasionally smiling and laughing.

The hijacking brought, for a few hours at least, another security crisis to the European Union just days after an attack on a Berlin Christmas market killed 12 people. The main suspect in the Berlin attack, a Tunisian, was killed in a shootout with Italian police Friday.

Malta, a tiny nation of less than half a million people that lies south of Sicily, is an E.U. member.  

Mahfouz reported from Cairo. Karla Adam in London and Sudarsan Raghavan in Cairo contributed to this report.