The militants who were from the Islamic State raided the consulate of Turkey in June and took 49 people hostage, including Ozturk Yilmaz the Consul General.
Others whom were abducted included Yilmaz’s family, children as well as other citizens who had been inside the consult located in Mosul at the time of the raid, said Recep Tayyip Erdogan the President of Turkey.
It is still not clear how the hostages had been freed, but Erdogan gave thanks to intelligence officials from Turkey in a prepared statement that was posted on his official website.
Ahmet Davutoglu the Prime Minister described the rescue of the hostages as a late night operation.
At 11:30, the Prime Minister said the rescue operations had reached a final stage.
Mosul, which had a population of 1.6 million, fell swiftly under militant attacks, back on June 10.
The radicals who were heavily armed overran the police stations freeing over 1,000 prisoners and took control of the international airport.
Iraqi forces fled in the face of such onslaught leaving behind armed vehicles, weapons and even uniforms.
Islamic State had declared a caliphate in the area that included large areas of land in both Syria and Iraq.
Turkey has not yet joined a coalition led by the U.S. to battle the heavily armed militants due to the hostages.
There were reports that the Islamic State was demanding a ransom of $100 million or more for their release.
Now with the hostages freed, Turkey could become one of the key members of the coalition as it borders both Iraq and Syria.
In a separate development, a deputy prime minister in Turkey said thousands of Syrian Kurds entered Turkey in one day after Ankara opened the border.
The deputy prime minister said over 45,000 Syrian Kurds crossed into the country of Turkey fleeing clashes with fighters from Islamic State.