Updated

The Bureau of Prisons (BOP) sharply rejected a judge's justification for releasing former Trump attorney Michael Cohen back to home confinement on Thursday, saying the decision was based on "patently false" assertions.

Earlier Thursday, U.S. District Judge for the Southern District of New York Alvin Hellerstein said the recent move by the Justice Department (DOJ) to put Cohen back in prison was “retaliatory" and claimed it was related to his forthcoming tell-all book. Hellerstein noted that probation officers had demanded Cohen agree to avoid engagement with the media, then cuffed him when he didn't agree.

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

Hellerstein's decision came after Cohen earlier this month was sent back to prison and into solitary confinement at Otisville federal prison in upstate New York after violating the terms of his home confinement. Reports said Cohen was seen at a restaurant in Manhattan, which raised concerns that he was in violation of his home confinement terms.

COHEN SUES BARR, CLAIMS HE WAS SENT TO PRISON TO PREVENT TRUMP TELL-ALL

Cohen had been released on furlough on May 21 to serve out the remainder of his three-year sentence -- but allegedly failed to take necessary steps to finalize that transfer. In a statement, the Bureau of Prisons charged that instead of complying with the terms of the U.S. Probation Office’s Federal Location Monitoring (FLM) program, Cohen was obstinate.

"Any assertion that the decision to remand Michael Cohen to prison was a retaliatory action is patently false," the Bureau of Prisons said. During this process of transitioning to home confinement, the bureau said, Cohen "refused to agree to the terms of the program, specifically electronic monitoring."

Additionally, he was "argumentative" and "was attempting to dictate the conditions of his monitoring, including conditions relating to self-employment, access to media, use of social media and other accountability measures." Cohen also allegedly "refused to acknowledge and sign the conditions of his transfer of home confinement and was remanded into custody."

"While it is not uncommon for BOP to place certain restrictions on inmates’ contact with the media, Mr. Cohen’s refusal to agree to those conditions here played no role whatsoever in the decision to remand him to secure custody nor did his intent to publish a book," the bureau said.

It was not immediately clear whether the DOJ would appeal. Cohen and his attorneys accepted conditions laid out by the judge, except for one focused on the book and his use of social media, which is expected to be renegotiated.

Meanwhile, Cohen's legal team celebrated the victory.

“This order is a victory for the First Amendment,” Danya Perry of Perry Guha LLP, who argued on behalf of Cohen at the hearing, said in a statement. “The First Amendment does not allow the government to block Mr. Cohen from publishing a book critical of the president as a condition of his release to home confinement. This principle transcends politics. We are gratified that the rule of law prevails.”

The decision comes after Cohen sued Attorney General Bill Barr for allegedly violating Cohen’s First Amendment rights when he was remanded earlier this month. The American Civil Liberties Union (ACLU) joined Cohen in the suit.

“Today’s important ruling recognizes that individuals retain their right to speak even when they are incarcerated,” Vera Eidelman, staff attorney with the ACLU’s Speech, Privacy, and Technology Project said in a statement Thursday.  “This is a victory for the First Amendment rights of people in prison, and for the public’s ability to hear from a group of people that is too often silenced in our society."

“He is being held in retaliation for his protected speech, including drafting a book manuscript that is critical of the President—and recently making public his intention to publish that book soon, shortly before the upcoming election,” the petition read.

Fox News' Brooke Singman contributed to this report.