Aircraft with 118 people on board was hijacked by men claiming to have hand grenades who threatened to blow it up.

Two hijackers of a Libyan aircraft with 118 people on board surrendered to authorities on the island of Malta hours after claiming to have hand grenades and threatening to blow the plane up unless their demands were met.

Maltese prime minister Joseph Muscat said on Twitter that all passengers and crew had been safely released by Friday evening.

The hijackers, Muscat said, had “surrendered” and been “searched and taken [into] custody”.

The prime minister said the hijackers had one pistol and one hand grenade on them, and a second handgun was later found on the plane.

In a later statement, the government said initial forensic investigations showed that the weapons used by the hijackers were identical “replica” weapons – imitation weapons that may not actually fire, but are difficult to distinguish visually from real guns.

One of the hijackers told the flight crew of the Afriqiyah Airways plane that he was “pro-Gaddafi”. Former Libyan leader Muammar Gaddafi was killed in an uprising in 2011, and the country has been racked by factional violence since.

Libya passenger jet hijacked, diverted to Malta

Mohamed Taher Siala, Libyan foreign minister, confirmed the two hijackers were supporters of the slain dictator Gaddafi and had requested political asylum in Malta.

Siala, from Libya’s internationally backed Government of National Accord, said the hijackers also said they want to set up a pro-Gaddafi political party.

Hours after landing, people could be seen disembarking from the aircraft.

Tim Diacono, a journalist from Malta Today, told Al Jazeera the hijackers had grenades and “threatened to blow the plane up”.

The last major hijacking on the tiny Mediterranean island of Malta was in 1985, when Palestinians took over an EgyptAir plane. Egyptian commandos stormed the aircraft and dozens of people were killed.

Security personnel took up positions a few hundred metres from the plane as it sat on the tarmac on Friday.

Malta-based journalist Karl Stagno-Navarra said one of the hijackers had appeared at the door of the plane waving a large green flag – similar to the old Libyan flag under Gaddafi’s rule. After a few moments, he put the flag down and returned inside.

“This is not an issue of international ‘terrorism’, this is an issue of internal feud that is still ongoing in Libya,” Stagno-Navarra said.

The aircraft had been flying from Sebha in southwest Libya to Tripoli for state-owned Afriqiyah Airways, a route that would usually take about two hours.

The Afriqiyah Airways plane was diverted towards Malta, but turned back as far as Libyan airspace before changing course again and flying to the Mediterranean island, an airline official said.

UN launches new round of Libya peace talks

Malta is about 300km north of the Libyan coast.

Prime Minister Muscat also tweeted that the passengers on board the plane included 82 men, 28 women and one infant.

The pilot of the Afriqiyah Airways plane told the control tower the aircraft had been hijacked, a senior security official at the airport said.

“The pilot reported to the control tower in Tripoli that they were being hijacked, then they lost communication with him,” the official told Reuters, speaking on condition of anonymity.

“The pilot tried very hard to have them land at the correct destination, but they refused.”

Reports said the two hijackers were in their mid-20s and were from the Tebu, an ethnic group present in southern Libya from where the plane departed.