The hostage siege aboard EgyptAir flight MS181 has ended with the hijacker Seif Eldin Mustafa being arrested, according to the Cypriot Foreign Ministry. All the passengers on the plane that diverted to Larnaca Airport have been released.

A standoff lasting almost six hours came to an end with the last eight remaining passengers and crew onboard the A321 EgyptAir jet making their bid for freedom. One crewmember made a daring escape by sliding through the cockpit window, while others could be seen running down the plane’s steps and away to safety.

The hijacker emerged from the aircraft with his hands in the air, state TV said. Mustafa is now in the custody of Larnaca Airport authorities, who will question him about his actions.

An official from the Cyprus Foreign Ministry said the hijacking incident did not appear to be related to terrorism, but the official added Seif Eldin Mustafa appears to be unstable.

Egyptian Prime Minister Sherif Ismail confirmed the hijacker was an Egyptian national and the authorities would now try to find out what his motives were.

"At some moments he asked to meet with a representative of the European Union and at other points he asked to go to another airport, but there was nothing specific," he said.

Flight MS181 was on an internal flight from Alexandria to the capital Cairo. However, the plane was diverted to Cyprus and eventually landed at Larnaca Airport at 08:46 local time, with 81 passengers onboard.

Our flight MS181 is officially hijacked. we'll publish an official statement now. #Egyptair — EGYPTAIR (@EGYPTAIR) March 29, 2016

The Egyptian Civil Aviation Ministry said one of the pilots of the EgyptAir plane, Omar Al-Gammal, told the authorities he was threatened by a passenger with a suicide belt. However, it later emerged that information regarding explosives was false.

Egyptian state media earlier said the hijacker was a citizen of Egypt, and he was initially named as Ibrahim Samaha. However, the Egyptian government later admitted it had made a mistake and apologized to Samaha, who is a university professor at Alexandria University.

Gamal Al-Omrawi, a deputy dean at Alexandria University, said Samaha was a passenger on the plane and not the hijacker. He said he had spoken by phone to Samaha, who confirmed he was one of the passengers who had been released.

Earlier, two Cypriot broadcasters reported the hijacker had dropped a letter on the apron of Larnaca Airport. It appeared to demand the release of prisoners in Egypt.

The hijacker had asked for a translator and wanted political asylum in Cyprus, according to the Greek television station Sky. There were also reports that he wanted to see his ex-wife, who is from Cyprus.

BREAKING: Hijacked Egyptian passenger plane lands at Larnaka airport, Cyprus - reports https://t.co/HpaivxSBMypic.twitter.com/lZSRlcGKlJ — RT (@RT_com) March 29, 2016

This latest incident will be a bitter blow to the safety reputation of Egypt’s air industry, which is still reeling after a bomb on a Russian passenger plane on October 31, 2015, killed all 224 people on board.

Islamic State (IS, formerly ISIS/ISIL) claimed responsibility for bringing down the Russian A321 passenger jet over Sinai, as it was bound for St. Petersburg.

Two employees at Sharm el-Sheikh Airport were arrested on suspicion of assisting those who planted the explosive device on the Russian jet.

MORE: 17 men being held on suspicion of helping those planted bomb on jet #7K9268#Sinaihttps://t.co/Raz9C3K5kLpic.twitter.com/GFGmhRhW76 — RT (@RT_com) November 17, 2015

Earlier last November, an AP investigation found that Sharm el-Sheikh Airport had many gaps in security, such as lax searches at the entry gate and poor quality of scanning devices. Seven officials involved in security at the airport, including some with more than a decade’s service, told AP of the lapses, speaking on condition of anonymity.

A 10-year-old CTX scanner had broken down several times because operators didn't use it properly, an official at the airport said. "I have seen people unplug it to save power."

Another official added that the machine wasn’t working properly at all and only managed to scan a sample of the bags, and not all of their contents.