Egypt denied permission for the plane to land
Two hijackers of a Sudanese plane flown to Libya have given themselves up in the desert town of Kufra.
The surrender comes almost 24 hours after they seized the plane, shortly after it left Nyala in Darfur.
The crew have also been freed - earlier all 95 passengers on board the Sun Air Boeing 737 had been released.
There are some reports that the hijackers were members of a Darfur rebel group but this was strongly denied by the group's leader.
"The hijackers surrendered without any violence and the crew are safe and sound," a Libyan official said, according to the AFP news agency.
A Sudanese diplomat in Kufra told the AP news agency that the two men were taken into the airport building, looking exhausted.
Mohammed al-Balla Othman said the men had requested asylum in Libya. Sudan had earlier demanded they be extradited.
The man had earlier demanded fuel to fly to France and one official said they wanted to be given refugee status there.
The BBC's Rana Jawad in Tripoli says a plane is being prepared to transport the freed passengers to Khartoum.
She says that video footage on Libya's state-run television showed the released passengers in the airport lounge looking relieved but tired.
"The night was terrifying and difficult," one man said. "I thank the Libyan authorities for their efforts which allowed us to be freed."
Another said the hijackers had been armed with pistols.
Before the passengers were freed, some fainted after the plane's air-conditioning failed, the pilot said.
The plane had been on its way to the Sudanese capital, Khartoum, on Tuesday, when the men took control.
It initially tried to land in Cairo, Egypt, where it was denied permission to land.
Sudanese officials say the hijackers belong to one of the numerous rebel groups fighting in Darfur.
According to the director of Kufra airport, who was quoted by Libyan media, the hijackers told the pilot they were from the rebel Sudanese Liberation Army of Abdel Wahid Mohammed Nur.
Mr Nur, who is based in Paris, has strongly denied any involvement in the hijacking.
"We categorically deny the responsibility of our movement in this hijacking operation," he told al-Jazeera television.
"We don't support putting the lives of Sudanese civilians at risk in any circumstances."
Three members of a different SLA faction, led by Minni Minawi, were aboard the plane.
A spokesman for this faction, the only one to sign a 2006 peace deal with the government, has also denied any involvement in the hijacking.
A five-year conflict in Darfur has left about 200,000 people dead and more than two million homeless.
The desert oasis of Kufra is in a remote region approximately 1,700km (1,050 miles) south of the Libyan capital, Tripoli.
It is an area close to both the Sudanese and Chadian borders, and is often used as a corridor for humanitarian aid for displaced Darfuri refugees in Chad, as well as a transit point into the country by illegal immigrants, says the BBC's Rana Jawad, in Tripoli.