ISTANBUL (Reuters) - A court sentenced Turkish journalist Ali Unal to 19 years in jail on Wednesday on a charge of being a leader in the network accused of carrying out a failed coup in July 2016, state-owned Anadolu news agency reported.

The ruling followed a sustained crackdown in the wake of the coup attempt, but also came amid steps by the government that appear aimed at improving ties with the United States and Europe, strained by the sweeping campaign of arrests.

Unal was chief writer at the now-defunct Zaman newspaper, widely seen as the flagship media outlet for the network of U.S.-based cleric Fethullah Gulen, whom Ankara says orchestrated the attempted putsch. Gulen denies any involvement.

Speaking by video link from jail to the court in the western province of Usak, Unal denied being a founder or leader of the network and denied involvement in the putsch, Anadolu said.

“I have no link with any terrorist organization,” he said, adding that he had spoken five or six times to Gulen and that he was being tried over his writing.

He was sentenced to 19 years and six months for “leading an armed terrorist group”. Six other Zaman journalists were convicted on similar charges in July.

Some 250 people were killed in the coup attempt and in the subsequent crackdown Turkey jailed 77,000 people pending trial. Authorities also sacked or suspended 150,000 civil servants and military personnel and shut down dozens of 130 media outlets.

Illustrating the scale of its actions, Foreign Minister Mevlut Cavusoglu said on Wednesday his ministry had dismissed 23 percent of its career personnel over links to Gulen.

Erdogan has said some journalists helped nurture terrorists with their writing, and that the crackdown is needed to ensure stability in a NATO member bordering Syria, Iraq and Iran.

Critics say Erdogan has used the crackdown to muzzle dissent and increase his own power. The European Union, which Turkey aspires to join, has also criticized the crackdown.

“BLACK COMEDY”

The verdict came a day after another court threw out the conviction of a former Wall Street Journal reporter, annulling a verdict sentencing her to two years in prison in absentia on charges of carrying out propaganda for Kurdish militants.

That ruling coincided with signs that Ankara is seeking to revive ties with Western allies damaged in part by concerns about its human rights record in the wake of the crackdown. In one example, Turkey last month released a U.S. pastor after two years in prison who had been accused of links to Gulen.

Ayla Albayrak, a reporter with dual Turkish and Finnish citizenship, was sentenced last year over a 2015 story about clashes between Turkish security forces and Kurdistan Workers Party (PKK) militants in southeastern Turkey.

“The black comedy part of my life called ‘a trial’ finally ended. It’s been exactly 3 years since the investigation started in Nov 2015 over a WSJ story,” Albayrak wrote on Twitter.

After the 2015 collapse of a ceasefire, intense conflict erupted between the Turkish military and the PKK, designated a terrorist group by Turkey, the United States and EU.

The court dismissed the case on procedural grounds, citing statute of limitations, and did not rule on the substance of the charges, the Wall Street Journal said.

Turkey ranks 157th out of 180 countries in the 2018 World Press Freedom Index of Reporters Without Borders, which says 29 journalists are currently in prison in Turkey.