Jubilant scenes in Lebanon and Turkey have greeted the return home of nine Lebanese and two Turkish hostages freed in a swap deal.

A plane with nine Lebanese hostages freed from northern Syria landed safely in Beirut last night - nearly a year and a half after the men were captured by Syrian rebels near the Turkish border.

Two kidnapped Turkish pilots arrived in Istanbul's Ataturk airport almost simultaneously - completing a hostage exchange after periods of uncertainty.

Prime Minister Tayyip Erdogan greeted the Turkish Airlines pilots as they disembarked from a Qatar Airways jet to cheers from family members.

The two had been snatched in a retaliatory kidnapping in August by relatives of one of the Lebanese held. 

Qatari officials negotiated the hostage swap deal, freeing the two Turkish pilots taken in August 2013.

Crowds of relatives and friends were already gathered at Beirut airport to celebrate their return as a Qatari jet landed.

The Lebanese hostages' families say they were religious pilgrims.

Their kidnappers accused them of belonging to the Lebanese militant group Hezbollah.

It has been fighting alongside President Bashar al-Assad's forces in Syria's civil war.

One man who was embraced by his cheering family at the airport said: "(Thank) God up there that He brought us back to our country safe and with victory, to meet our dear ones and parents, despite all the tragedy and obstacles that we went through."

Another freed hostage, Rabih Saleh, said he wanted to thank those involved in negotiations for their release.

"Thank God. I can't say anything but thank God and I thank everybody who worked for my and my comrades' release."

Shia cleric Fouad Khreiss who was at the airport to greet the freed hostages said the release of the nine hostages was a cause for celebration - and as a victory for dialogue.

"Here we can say that we can take a lesson and tell it to all the officials in the Arab and Muslim countries: we are able to resolve our problems in dialogue."

One of the Turkish hostages said their captors treated them respectfully and did not use violence against them.

"We were not treated badly, I can say that clearly. We were never treated brutally. We were not exposed to verbal or physical violence. If that had been the case you can be sure that we would not have arrived here," Murat Agca told reporters.

"We have done everything that a Turkish citizen should have done and the Turkish state stood by us. We believed that and we knew that they wouldn't leave us there. God bless everyone," he added.

The Lebanese, seized by Syrian rebels in May 2012, were freed and left northern Syria a day earlier as part of the deal negotiated by Qatari mediators.

The hostages' release may in fact be a three-way deal, Lebanese security sources said. They said the release of the Lebanese was originally contingent on the Syrian government's freeing of prisoners in state detention centres.

An opposition monitoring group, the Syrian Observatory for Human Rights, said the government had released dozens of prisoners over the past few days as part of that agreement.

The kidnappings highlight how complex and regionalised Syria's conflict has become. The civil war has acquired sectarian dimensions that have pulled in its neighbours.

Sunni Muslim countries such as Turkey largely back the Sunni-led uprising against President Bashar al-Assad's rule.

Iran backs Assad, as does the Lebanese militant group Hezbollah, which is Shia and supported by Tehran. Assad is from the Alawite sect, an offshoot of Shia Islam.

The Turkish pilots were kidnapped by the family of one of the Lebanese hostages in order to press the Turkish government to help secure the group's release.

Turkey has some influence with the Syrian opposition, having offered refuge and support to the rebels fighting President Assad.