By AARON KATERSKY and IVAN PEREIRA, ABC News

(NEW YORK) — Michael Cohen alleges he was sent back to federal prison and put in solitary confinement as retaliation over a tell-all book on the president he aims to publish, according to a lawsuit filed by the disgraced attorney.

Cohen filed the suit in New York Federal Court Monday against U.S. Attorney General William Barr, the U.S. Bureau of Prisons and the Warden of the Federal Correctional Institution in Otisville, New York, where Cohen is currently confined, contending his detainment is in “retaliation for his protected speech.”

Cohen, who is serving a three-year sentence for violating campaign finance laws and lying to Congress, was sent back to the facility on July 9 after spending two months on furlough in home confinement.

He alleges in the suit that U.S. Probation Officers offered him “an unconstitutional demand” where he was prohibited from speaking to the media in any form. That stipulation included a book that Cohen has been writing over the last year where he claims he will reveal new details about the president during his decade as Trump’s attorney, according to the suit.

“The First Amendment forbids respondents from imprisoning Mr. Cohen in retaliation for drafting a book about the President and for seeking to publish that book soon,” the suit said.

A spokesperson for the Bureau of Prisons told ABC News in a statement that it does not comment on pending litigation. Representatives for Barr’s office didn’t immediately respond to a request for comment.

The Department of Justice furloughed Cohen, 53, from prison and released him to his Manhattan home in May over coronavirus concerns in federal detention facilities. The suit said he had been working on his manuscript shortly after he was sent to the Otisville facility in 2019 and complied with prison rules.

“Mr. Cohen did most of his writing in plain sight in the law library. Indeed, staff at Otisville, including Camp Administrator Robert Schreffler and Correctional Counselor James DeLeo, explicitly informed Mr. Cohen that they were aware he was writing a book,” the suit said.

The suit said the book will detail Trump’s behaviors behind closed doors such as making “pointedly certain anti-Semitic remarks against prominent Jewish people and virulently racist remarks against such Black leaders as President Barack Obama and Nelson Mandela.”

Cohen continued to work on the manuscript after he was furloughed and teased the book on his Twitter account on July 2, according to the suit.

During a meeting on July 9 with probation officers to formalize terms of homeconfinemen on July 9, Cohen and his attorney asked for clarification on the home confinement demands that restricted his public comments. Probation officers said his request would be sent “up the chain of command” for a decision, according to the suit. Cohen and his attorney stayed in a waiting room for about an hour-and-a-half and never received clarification or an agreement to sign before agents took him back into custody, the suit alleges.

During a court hearing on July 9, Cohen and his attorney asked for clarification on the home confinement demands and probation officers said his request would be sent “up the chain of command” for a decision, according to the suit. Cohen and his attorney stayed in a waiting room for about an hour-and-a-half before agents took him back into custody, the suit alleges.

He is currently living in a 12-by-8-foot cell in the prison by himself, according to the suit.

The suit contends that Cohen never refused to sign the agreement over his confinement rules and the Bureau of Prison’s statements about his conduct and responses to the court orders are false.

Two other books about the president have drawn legal challenges, including “The Room Where it Happened” by former national security adviser John Bolton and “Too Much and Never Enough” by Mary Trump, the president’s niece. Both have been published.

“The government’s effort to exercise prior restraint over Mr. Cohen’s book is only the latest in the Trump Administration’s efforts to censor speech that reflects negatively on Trump himself or his Administration,” Cohen’s lawsuit said.

Copyright © 2020, ABC Audio. All rights reserved.