Michael Avenatti, lawyer of adult-film actress Stormy Daniels speaks to media as he exits the United States District Court Southern District of New York on May 30, 2018 in New York City.

Avenatti was referring to a separate motion by Daniels to intervene in Cohen's case for the purpose of potentially asserting claims of attorney-client privilege on documents seized from Cohen by the FBI last month that relate to her.

In a statement, Avenatti said, "It is now not necessary because the motion to intervene is being held in abeyance by agreement with the government. We are on the verge of getting the documents we need."

Avenatti has become a constant media presence and pugnacious critic of Trump and Cohen since his client sued them both to be released from a nondisclosure agreement she signed before the 2016 election. Daniels was paid $130,000 as part of the deal in exchange for her silence about an alleged affair with Trump from years earlier.

The withdrawal came hours after U.S. District Judge Kimba Wood said Avenatti would have to end his "publicity tour" if he were admitted as a lawyer for the porn star Daniels in Cohen's case.

Michael Avenatti on Wednesday withdrew his motion to represent his client Stormy Daniels in the ongoing court proceedings involving President Donald Trump 's personal lawyer, Michael Cohen .

Cohen is under criminal investigation by federal prosecutors in New York City. He has not been charged, but evidence seized from him last month is in the process of being reviewed and turned over to prosecutors.

A trial lawyer in California, Avenatti would need Wood's permission to be admitted in New York federal court solely for Cohen's case. Such pro hac vice admissions are routinely requested by out-of-state lawyers and are rarely denied.

Wood noted that it would be premature to rule on Avenatti's request for admission in the case without first addressing the pending motion by him, on Daniels' behalf, that Daniels be allowed to intervene in the case.

Wood also said that if she were to grant Avenatti's motion for such an admission, he then would be bound by a code of conduct that would prevent him from both stating his opinion on Cohen's purported guilt and from releasing non-public information related to Cohen.

Avenatti has done both — notably by releasing a report on May 8 showing payments made to Cohen's company, Essential Consultants, after the election by corporations including telecom giant AT&T, drug maker Novartis and Korea Aerospace Industries. He has recently indicated he plans to reveal more information about Cohen.

Lawyers for Cohen had questioned in a court filing how Avenatti could have obtained the information, which appeared to be drawn from confidential bank records.

In court Wednesday, Avenatti said he and his client "did not do anything improper relating to the release of any information concerning Mr. Cohen."

Cohen's lawyer, Stephen Ryan, said at the courthouse, "I've never seen an attorney conduct himself the way Mr. Avenatti conducted himself. What Mr. Avenatti did in releasing those records was entirely improper."

Ryan strongly opposed Avenatti's admission request.

Avenatti withdrew the motion without prejudice in a court filing following the hearing, meaning it could "be re-filed, if necessary, at a later time."

Ryan did not immediately respond to CNBC's request for comment on Avenatti's withdrawal.

Both Trump and the Trump Organization have been granted intervenor status in the case which allows them to make arguments related to evidence seized from Cohen which might be protected by the president's and the company's attorney-client privilege.

Avenatti has argued that Daniels is entitled to the same intervenor status by virtue of documents related to her and to her prior lawyer, Keith Davidson, which are believed to have been seized from Cohen by the FBI.

Avenatti said Wednesday that he had been contacted by a reporter with a recording he believes was made by Cohen that involved Davidson.

Davidson represented Daniels when she received the $130,000 payment from Cohen through Essential Consultants.

"From what I understood there were audio recordings" between Cohen and Daniels' former lawyer, Keith Davidson, "regarding attorney-client privilege," Avenatti said.