ISTANBUL — Serkan Golge, a Turkish-American scientist imprisoned in Turkey for nearly three years, has been released.

Morgan Ortagus, a State Department spokeswoman, declined to discuss why he was released.

However, she told reporters Wednesday it was the "right thing to do."

Golge was on a family visit in southern Turkey when he was arrested in the aftermath of a failed coup, which Turkey blames on U.S.-based cleric Fethullah Gulen.

Golge, a father of two who worked for NASA, was convicted in February 2018 for membership in a terrorist group and sentenced to 7 1/2 years, subsequently reduced to five by the appeals court.

His wife Kubra Golge told The Associated Press that she spoke on the phone with him upon his release and that he was very happy.

Last year, Kubra Golge told NBC News that the family had to sell their house in Houston, Texas, following her husband's arrest.

Golge denies links to Gulen's network. Gulen has denied any involvement in the 2016 coup.

Cases against U.S. consulate employees and American citizens in Turkey on terrorism charges have been a major source of disagreement between the NATO allies.

Citing a copy of the court ruling, Reuters reported that Golge was freed due to the amount of time he had already served. The ruling said that Golge was released under judicial control, meaning he is not allowed to leave the country and will have to regularly report to local authorities.

Ortagus, the State Department spokeswoman, added: "We will continue to provide all appropriate consular services to Mr. Golge, including making sure he can return home as soon as possible.”