A Manhattan federal judge on Thursday ordered Michael Cohen released from prison, finding that his June 9 remand into custody was done in retaliation for his forthcoming tell-all book about his time working as President Donald Trump’s personal attorney.

U.S. District Judge Alvin K. Hellerstein of the Southern District of New York said in a hearing that in his 21 years on the bench, he had “never seen” a clause requiring that a candidate for home confinement agree not to speak to the media, and he roundly rejected the government’s claims that Cohen’s jailing was the result of his failing to cooperate with the terms of his release.