- Hostages included the consul general of the Turkish consulate in Mosul
- His family and other citizens who were at the consulate were also abducted
- It's unclear how they were freed, but Erdogan thanked Turkish intelligence officials
Dozens of Turkish hostages abducted by Islamist militants in northern Iraq were freed Saturday after three months in captivity.
Militants from the Islamic State in Iraq and Syria
raided the Turkish consulate in June and seized 49 people, including Consul General Ozturk Yilmaz.
Others abducted included his family, children and other citizens who were at the consulate in Mosul at the time, Turkish President Recep Tayyip Erdogan said.
Of the total, three were local employees and 46 were Turkish citizens. All were freed and the latter are now in their home country, Turkish authorities said.
It's unclear how they were freed, but Erdogan thanked Turkish intelligence officials in a statement on his website.
"I thank ... every single member of the national intelligence agency from the director to the field operatives," he said. "I congratulate them for their big success from the bottom of my heart."
Prime Minister Ahmet Davutoglu described it as a late-night operation.
"At around 11:30 at night, this rescue effort reached its final stage," he told a crowd waving flags in Ankara. "Be assured that for months we worked toward this. I thank those in our national intelligence agency who worked relentlessly and with great sacrifice."
Mosul, a city of 1.6 million, collapsed swiftly when the militants attacked on June 10. The heavily armed radicals overran police stations, freed more than 1,000 prisoners from the local jail and took over the international airport.
American-trained Iraqi forces ran in the face of the onslaught, leaving behind uniforms, weapons and armored vehicles.
ISIS, which calls itself the Islamic State, has declared that it has established a "caliphate" spanning large swaths of Iraq and Syria.
Turkey has been wary of joining a U.S. coalition to battle the militants because of the hostages, according to Faysal Itani, a fellow at the Atlantic Council's Center for the Middle East.