The ACLU and lawyers for Michael Cohen announced a lawsuit Monday against U.S. Attorney General William Barr and others for allegedly violating Cohen’s First Amendment rights when he was remanded earlier this month.

“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.

Cohen, President Trump's former personal attorney, was ordered into custody earlier this month after reports said that he “failed to agree to the terms of Federal Location Monitoring” in Manhattan. The New York Post obtained photos of Cohen at a New York City restaurant.  A source told the paper, “That dinner caught the eye of those at [the Bureau of Prisons] who feel he was released on furlough only due to the coronavirus situation but is acting like he’s a free man and not out under supervision."

Cohen’s lawyers refuted the claim and said Cohen took issue with a condition of his home confinement that forbid him from speaking with the media and publishing a tell-all book he began working on in federal prison. The rules also prohibited him from “posting on social media,” the records show.

The lawyers filed a Petition for Writ of Habeas Corpus, which is employed when attorneys seek to challenge whether a prisoner’s detainment is lawful. The petition said that Cohen is currently being held in solitary confinement at the Federal Correctional Institution in Otisville, N.Y.

The Department of Justice did not immediately respond to a Fox News inquiry.

Cohen's campaign finance charges related to his efforts to arrange payouts during the 2016 presidential race to keep the porn actress Stormy Daniels and model Karen McDougal from airing claims of extramarital affairs with Trump. Trump has denied the affairs.

The Associated Press contributed to this report