A judge ordered the release from prison of President Donald Trump’s former personal lawyer on Thursday, saying he believes the government retaliated against him for writing a book about Trump.

Michael Cohen’s First Amendment rights were violated when he was ordered back to prison on July 9 after probation authorities said he refused to sign a form banning him from publishing the book or communicating publicly in other manners, U.S. District Judge Alvin K. Hellerstein said.

Hellerstein ordered Michael Cohen released from prison by 2 p.m. on Friday.