(Bloomberg) -- A Turkish newspaper columnist sentenced to a year in prison for insulting President Recep Tayyip Erdogan said he has been released on probation.

“When I went to the courthouse, they told me there is no space in the prisons and asked me to come back in 10 days,” Yavuz Selim Demirag, a critic of the ruling party and its nationalist ally, said in an interview by phone. “At midnight, I was told that I am being released on probation.”

Demirag has said he’s being punished for comments made on a panel four years ago about lawmakers’ immunity. Social media outrage about his arrest and looming elections may have helped keep him out of prison, he said Wednesday.

Demirag was beaten by a mob with baseball bats in May after appearing on a talk show. While he was hospitalized with injuries, six suspects detained after the incident were released, Reporters Without Borders said in a report.

Turkey is the world’s worst jailer of journalists, according to the Committee to Protect Journalists. Tens of thousands of people have been investigated for insulting the president, and the owners and editorial leadership of top opposition newspapers have been jailed, detained or faced trial.

To contact the reporter on this story: Cagan Koc in Istanbul at ckoc2@bloomberg.net

To contact the editors responsible for this story: Onur Ant at oant@bloomberg.net, Tony Czuczka, James Ludden

©2019 Bloomberg L.P.