Turkish intelligence agents brought 46 hostages seized by Islamic State militants in northern Iraq back to Turkey on Saturday after more than three months in captivity, in what President Tayyip Erdogan described as a covert rescue operation.
Security sources told Reuters the hostages had been released overnight in the town of Tel Abyad on the Syrian side of the border with Turkey after being transferred from the eastern Syrian city of Raqqa, Islamic State's stronghold.
Officials declined to give details of the rescue operation.
The hostages, who included Turkey's consul-general, diplomats' children and special forces soldiers, were seized from the Turkish consulate in Mosul on June 11 during a lightning advance by the Sunni insurgents.
Family members rushed to the steps of the plane which brought the freed captives to the Turkish capital Ankara from the southern city of Sanliurfa, where they had earlier been welcomed by Prime Minister Ahmet Davutoglu.
Groups of supporters waved Turkish flags as Davutoglu hugged the consul-general and members of the diplomats' families before addressing the crowd from the roof of a bus, saying the authorities had worked tirelessly for the hostages' release.
"I thank the prime minister and his colleagues for the pre-planned, carefully calculated and secretly-conducted operation throughout the night," Erdogan said in a statement.
"MIT (the Turkish intelligence agency) has followed the situation very sensitively and patiently since the beginning and, as a result, conducted a successful rescue operation."
Speaking to reporters earlier in Azerbaijan before cutting short an official visit, Davutoglu declined to give details on the circumstances of the hostages' release, saying only that it was carried out "through MIT's own methods".
Turkish officials had repeatedly said efforts were underway to secure their freedom and that the hostages were in good health but had declined to comment further.
Three non-Turkish civilians who were taken in the same attack were also released in the operation on Saturday, a foreign ministry official said.
Independent broadcaster NTV said Turkey did not pay a ransom and that no other country was involved. There were no clashes with Islamic State militants during the operation, it said.
Without naming its sources, it said MIT had tracked the hostages as they were moved to eight different locations during their 101 days in captivity.
Their capture had left Turkey, a member of the NATO military alliance and a key U.S. ally in the Middle East, hamstrung in its response to the Sunni insurgents, who have carved out a self-proclaimed caliphate in parts of eastern Syria and western Iraq, just over the Turkish border.
The rapid and brutal advance of Islamic State, bent on establishing a hub of jihadism in the center of the Arab world and on Turkey's southern fringe, has alarmed Ankara and its Western allies, forcing them to step up intelligence sharing and to tighten security cooperation.
Turkish Deputy Prime Minister Numan Kurtulmus said on Saturday tens of thousands of Syrian Kurds had crossed into Turkey over the past day after Islamic State seized dozens of villages close to the border.
The United States is drawing up plans for military action in Syria against Islamic State fighters, but Turkey had made clear it did not want to take a frontline role, partly because of fears for the fate of the hostages.
The militants have beheaded two U.S. journalists and one British aid worker, using the tactic to put pressure on Western governments after U.S. air strikes helped halt Islamic State's advances.
British and U.S. officials have said in recent weeks that their nationals had been killed by Islamic State militants in part because other countries were paying ransom money.
France was able to secure from Islamic State the release of four of its nationals in Syria earlier this year, after what President Francois Hollande said was help from other countries.
Hollande reaffirmed on Thursday that Paris did not pay ransoms or exchange prisoners for the release of its citizens who are held hostage overseas.
Officials will not divulge the number or nationality of hostages taken in Syria for fear of putting their lives at risk.