A judge ordered Donald Trump's former personal lawyer Michael Cohen be released to home confinement Thursday after ruling that officials re-detained him as punishment for writing a book about the US president.
The ruling was the latest twist in a long-running legal saga involving Cohen, who once bragged he'd "take a bullet" for Trump before later implicating him in crimes.
Cohen was sentenced to three years in jail in December 2018 after admitting paying hush money to two women who say they slept with Trump, for tax fraud and for lying to Congress.
Cohen was released on prison furlough on May 21 as part of a push to stem the spread of COVID-19 among inmates.
But the 53-year-old lawyer was taken back into custody by officials at the Federal Bureau of Prisons on July 9 after declining to agree to the conditions of his home confinement.
His lawyers successfully argued that Cohen was returned to jail because he refused to agree not to publish an unflattering book that he is writing about Trump.
New York Judge Alvin Hellerstein said the condition violated the First Amendment, which protects people's right to freedom of expression, including through publishing.
"I make the finding that the purpose of transferring Mr Cohen from furlough and home confinement to jail is retaliatory," the judge said, according to US media.
"And it's retaliation because of his desire to exercise his First Amendment rights to publish a book and to discuss anything about the book or anything else he wants on social media and with others," he added.
The judge ordered that Cohen be released to home confinement in Manhattan on Friday.
Cohen's attorneys said in court documents that the memoir "provides graphic details about the president's behavior behind closed doors."
"For example, the narrative describes pointedly certain anti-Semitic remarks against prominent Jewish people and virulently racist remarks against such Black leaders as President Barack Obama and Nelson Mandela," they wrote.
Once Trump's right-hand man, Cohen fell out of favor with the president, who dubbed him a "rat" after his former confidante testified in federal court and to Congress.
Cohen admitted a number of crimes including violating campaign finance laws by delivering payments prior to the 2016 election to a porn star and a former Playboy model who alleged having had affairs with the president.
Trump denies the allegations.