A federal judge in New York ordered Thursday Michael Cohen, US President Donald Trump’s former lawyer, released again from prison.

In issuing the ruling, US District Judge Alvin Hellerstein reportedly agreed with Cohen’s lawyers that he was sent back to prison from serving his sentence under home release because Cohen was writing a book critical of the president, ruling Cohen’s First Amendment rights had been violated.

Cohen earlier this week sued over allegations he was being sent back to prison in retaliation for writing the book.

While serving his first stint under home release Cohen tweeted he was close to finishing a tell-all book with an expected release date in September, just about two months before Americans vote to decide their next president.

But a week after he tweeted, a probation officer told him he would have to agree to a prohibition on speaking publicly, including a ban on his book, in order to remain under house arrest, according to NBC News.

He was asked to sign a form that stipulated,”No engagement of any kind with the media, including print, tv, film, books, or any other form of media/news. Prohibition from all social media platforms.”

“I’ve never seen such a clause in 21 years of being a judge and sentencing people,” Hellerstein reportedly said. “How can I take any other inference but that it was retaliatory?”

Hellerstein ordered Cohen be released by 2 p.m. local time (1800 GMT) Friday.

Copyright 2022 Anadolu Agency. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.