Prison authorities have withdrawn Michael Cohen's medical leave in revenge for wanting to write a book about U.S. President Donald Trump, a federal judge said Thursday. The judge ruled that Cohen may therefore serve his sentence at home again, according to The New York Times.

Cohen was one of Trump's prime confidants for years, but later decided to testify against the president in the Russia investigation. Cohen was then sentenced to three years in prison for, among other things, fraud while working for Trump's election campaign.

In April, Cohen, once known as "Trump's pit bull," was allowed medical leave due to the outbreak of COVID-19 in the US prison system. When that leave was withdrawn this month and he had to go back to jail, Cohen lodged an objection with the judge on Monday evening.

"I judge Cohen was transferred from house arrest to prison for revenge," Judge Alvin Hellerstein said on Thursday. "It is out of revenge because he wants to exercise his right to freedom of expression by publishing a book and discussing it on social media with others."

Judge surprised at condition

The US Attorney General states that the leave was terminated because Cohen was a recalcitrant during a conversation with his probation officer.

But Cohen says he had to go back to prison because he did not agree to a leave condition, which forbade him to write a book or otherwise come out.

The judge agreed with Cohen and said he had never seen such a condition in more than twenty years.

Book describes Trump as 'scammer'

Trump's former lawyer has announced he will write a book showing that the president is a "racist", "con man" and "cheater" and sheds light on the behavior of the former real estate magnate and reality star "behind closed doors".

Cohen decided after his conviction in 2018 to testify against the President in the investigation of Russian interference in the run-up to the 2016 US elections. Following this investigation, led by Special Prosecutor Robert Mueller, Cohen was also charged and convicted of several crimes.

The former lawyer eventually confessed to paying hush money to women who say they had an affair with Trump, tax evasion, bank fraud, and a violation of campaign finance laws. He later confessed to lying to Congress.

See also: Michael Cohen: The 'pit bull of Trump' is now biting the boss