(NEW YORK) — Michael Cohen, President Donald Trump’s former attorney, will be released from a federal prison and return to home confinement in Manhattan.

Cohen, who is serving a three-year sentence for violating campaign finance laws and lying to Congress, was ordered back to the federal facility in Otisville, New York, on July 9 after spending two months on furlough in home confinement. The Federal Bureau of Prisons said Cohen didn’t agree to a clause in his home confinement agreement that forbade him from speaking with the media, including through a book.

Cohen contended in a lawsuit that he was being retaliated against by the federal government, which objected to a tell-all book on his experiences with Trump that’s slated to be released soon.

Federal Judge Alvin Hellerstein sided with Cohen on Thursday and ordered he be released.

“The purpose of transferring Mr. Cohen from furlough and home confinement to jail is retaliatory, and it’s retaliatory because of his desire to exercise his First Amendment rights and to publish a book,” Hellerstein said.

This is a developing story. Please check back for updates.

Copyright © 2020, ABC Audio. All rights reserved.