Michael Cohen, President Donald Trump’s former lawyer and fixer, will argue in court this week that his sudden return to prison is illegal retaliation for his decision to write an unflattering book about his ex-boss before this year’s election.

U.S. District Judge Alvin K. Hellerstein on Tuesday scheduled oral arguments for July 23 on Cohen’s emergency motion to be returned to home confinement from a federal lockup where he’s currently being held in solitary.

Cohen, who pleaded guilty in August 2018 to crimes tied in part to his work for Trump, sued on Monday with help from the American Civil Liberties Union, accusing Attorney General William Barr and Bureau of Prisons Director Michael Carvajal of using a false justification to lock him up.

Cohen claims that his planned book “sits at the zenith of First Amendment protection,” and that his imprisonment is payback for a memoir that will include “previously unknown anecdotes and details about Mr. Trump’s bad behavior behind closed doors.” Cohen has been drafting the book since the start of his incarceration in May 2019, according to the court filing.

Cohen was furloughed in April because of the spread of the coronavirus in prisons and ordered to finish his sentence under home confinement. But he claims the U.S. Probation Office said in July the home confinement would be rescinded unless he agreed to a total prohibition on “engagement of any kind with the media,” including through books.

He says when he asked for clarity on the provision, he was imprisoned before he got a chance to sign the deal. The U.S. now falsely claims he refused to sign, Cohen says.

Cohen compared his situation to those of the president’s niece, Mary Trump, and Trump’s former national security advisor, John Bolton, both of whom were sued to stop the release of books that portrayed Trump as a selfish and reckless individual who puts his own needs ahead of the country’s. Both suits failed to halt publication.

The Justice Department didn’t immediately return a message seeking comment. The Bureau of Prisons declined to comment.

The ACLU said Trump’s private lawyer had tried to stop Cohen from writing the book, claiming it violated a non-disclosure agreement, although Cohen says he never signed such a document.

“The government cannot imprison Michael Cohen for writing a book about President Trump,” Ben Wizner of the ACLU said in a statement on Monday. “The gag order that the government sought to impose on Mr. Cohen was an unconstitutional prior restraint, and his continued imprisonment is part of a dangerous pattern of retaliation against Trump critics.”

Cohen said his book may not be published on schedule now.

“Prior to Mr. Cohen’s remand, his book was on track for an anticipated September 2020 release date,” his lawyers said in the filing in federal court in Manhattan. “Progress towards publication has now been impeded due to Mr. Cohen’s remand and his fear of further retaliation”