Michael Cohen, President Trump’s former personal attorney, was taken back into federal custody Thursday amid a dispute over the conditions of his home confinement, according to the Bureau of Prisons and two of Cohen’s legal advisers.

Lanny Davis, one of the legal advisers, said that Cohen initially balked at agreeing to a Bureau of Prisons requirement that he not talk to reporters, not use social media and not write a book while on home confinement.

A Justice Department official, however, said Cohen “refused electronic monitoring” — which Davis and lawyer Jeffrey Levine disputed — and added: “It’s not that he can’t do media interviews. It’s that he has to get preapproval for them.” The official spoke on the condition of anonymity because they were not authorized to discuss the matter publicly. Documents obtained by The Washington Post show the requirement Cohen was asked to agree to was far more stringent than what the official described. In addition to consenting to electronic monitoring, Cohen had to agree to “No engagement of any kind with the media, including print, tv, film, books, or any other form of media/news. Prohibition from all social media platforms. No posting on social media and a requirement that you communicate with friends and family to exercise discretion in not posting on your behalf or posting any information about you,” the documents show.

“The purpose is to avoid glamorizing or bringing publicity to your status as a sentenced inmate serving a custodial term in the community,” the documents say. They also detail seven other conditions, such as not having contact with convicted felons, getting prior approval for employment and attendance of religious services, and having family members conduct shopping.

A memo from a residential reentry manager in New York to the U.S. Marshals alleged that Cohen “failed to agree to the terms of Federal Location Monitoring,” though it did not specify which terms, and asked that he be taken to the Metropolitan Detention Center in Brooklyn. In statements, the Bureau of Prisons similarly alleged Cohen had “refused the conditions of his home confinement” but did not specify which ones.

The move comes less than two months after Cohen was let out of federal prison early as part of the Justice Department’s push to stem the spread of the coronavirus among inmates. The president’s former self-proclaimed “fixer,” who would later become a Trump adversary, had been serving a three-year term for financial crimes and lying to Congress.

Davis, who does not formally represent Cohen as a lawyer, said Cohen had been scheduled to meet with probation officers on Thursday to get an ankle bracelet as part of a bureaucratic transition from being on “furlough” to being on “home confinement.” He said Cohen told him earlier in the day he had to “sign some papers and to get my ankle bracelet.”

Davis said Cohen was then presented with the list of conditions and objected — noting that he could correspond with reporters even while in federal prison, and that he had already written the book, reportedly a “tell-all” account about his relationship with Trump.

“He said, ‘But the book is already done, and I’m not giving up my First Amendment rights to talk to the media, to use social media, and especially, to publish a book,’ ” Davis said. Levine, who was with Cohen during the discussion, confirmed that account.

“My client says, ‘I’ve never heard of anybody losing their First Amendment rights,” Levine said.

The restrictions, Davis said, would have lasted through 2021 — the term of Cohen’s sentence.

Levine and Davis said the probation officers left, and about an hour and a half later, U.S. marshals returned and began putting Cohen in shackles. Levine said he objected, saying they were still discussing the restrictions and waiting for the probation officers, and the marshals responded, “We have our orders. We can’t do anything except take him away.” At one point, Levine said, Cohen even offered to sign the conditions “as-is,” but was told it was too late.

“I protested, and I said, ‘This just doesn’t make sense here,’” Levine said, adding that he is exploring asking the Bureau of Prisons and possibly the court system for Cohen’s release.

“He never refused to sign anything,” Levine said. “It was a conversation. It was an ongoing conversation.”

A U.S. Marshals spokesman did not respond to requests for comment.

Last week, Cohen was photographed by the New York Post eating outside the French restaurant Le Bilboquet, which is near his Manhattan apartment, sparking some speculation that he was violating the terms of his release. The Bureau of Prisons statement did not address that, and Levine said the matter was not discussed Thursday.

Davis said Cohen believed going to the restaurant “was not a violation of any rules, and he was never told that it was a violation of any rules.” He said he had spoken with Cohen directly about the matter.

“He believed it was consistent with the rules, or he wouldn’t have done it,” Davis said.

Cohen pleaded guilty in 2018 in two separate criminal cases. In the first, he admitted to campaign finance violations stemming from payments made before the 2016 election to adult film actress Stormy Daniels and another woman who alleged having affairs with Trump years earlier. Trump has denied their claims.

In the second case, Cohen admitted he lied to Congress about a Moscow real estate project Trump and his company pursued while Trump was trying to secure the Republican nomination to become president.

In court and in public, Cohen placed the blame for his actions squarely with the president, saying he felt it was his duty to cover up the “dirty deeds” of his former boss.

After reporting to prison in May 2019, Cohen repeatedly sought to get out early — most recently citing the threat he faced from the coronavirus pandemic. Prosecutors objected, and U.S. District Judge William H. Pauley III rejected that bid. But Cohen was then permitted to leave under a push by Barr to use new authority given to him by Congress to release more inmates amid the pandemic — though that was briefly delayed, according to Justice Department officials, because of new criteria imposed by the Bureau of Prisons about who would be prioritized for release.

According to information on the Bureau of Prisons’ website, more than 6,700 inmates have moved to home confinement as part of the response to coronavirus.