ANKARA (Reuters) - A Turkish court ordered the release of a jailed opposition lawmaker on Thursday who had been sentenced to more than five years for disclosing government secrets, the state-run Anadolu news agency said.

Slideshow ( 6 images )

Enis Berberoglu was the first lawmaker from the main opposition Republican People’s Party (CHP) to be jailed amid government purges following a failed military coup in 2016.

Berberoglu was initially sentenced in June 2017, to 25 years for espionage on charges that he gave an opposition newspaper a video purporting to show Turkey’s intelligence agency trucking weapons into Syria. He denied the charges.

In a retrial in February, Berberoglu’s jail sentence was cut to five years and 10 months in jail. In Turkey’s snap parliamentary election in June, Berberoglu was re-elected to parliament from behind bars.

Turkey’s court of appeals ruled on Thursday that Berberoglu’s sentence should be suspended and it freed him for the remainder of his term as a CHP lawmaker, Anadolu said.

The court of appeals was not immediately available for comment.

The opposition Cumhuriyet daily published its original report about the alleged weapons shipment to Syria based on a video that allegedly came from Berberoglu.

Two of the newspaper’s journalists, Can Dundar and Erdem Gul, were sentenced to at least five years in jail over the report, but were later released pending an appeal process.

Dundar, who for critics of President Tayyip Erdogan’s post-coup security clampdown has become a symbol of press freedom, has since left Turkey and is now being tried in absentia. Gul remains in the country and free while his appeal is in process.

More than 50,000 people have been detained and more than 150,000 have been sacked or suspended from their jobs since the abortive coup in July 2016. Around 150 media outlets have also been shut down, while 160 journalists have been jailed.

In April, a Turkish court sentenced 14 staff of Cumhuriyet to prison on terrorism charges and acquitted three, in a case that sparked global outrage over press freedom under Erdogan.