Mr. Avenatti has made adroit use of the news media a selling point for his Los Angeles-area practice. “Michael often works closely with the press and media,” his website reports. It cites cases he has brought against the National Football League, Paris Hilton and Jim Carrey, as well as previous appearances on “60 Minutes.” (One involved a case against Kimberly-Clark and Halyard Health for claims their surgical gowns protected against Ebola and other diseases in which he won a $454 million fraud verdict last year; the other involved alleged violations by cemetery operators.)

Ms. Clifford hired Mr. Avenatti a couple of weeks ago. (She was previously represented by another California attorney, Keith Davidson.) Within days Mr. Avenatti prepared to challenge the deal — which stipulated that disagreements would be argued in secret before a confidential arbitrator — arguing it was not valid because Mr. Trump did not sign it. (Mr. Avenatti on Sunday pointed to a clause that said the agreement was “valid and binding” when “signed by all parties.”)

A suit that Mr. Avenatti filed on Tuesday evening in Los Angeles County Superior Court included a nugget of news: Mr. Trump’s lawyer had initiated “a bogus arbitration proceeding” against Ms. Clifford to “shut her up.”

That appeared to force an error at the White House the next day, when the president’s press secretary, Sarah Huckabee Sanders, who had been avoiding engagement in Ms. Clifford’s story, said that an arbitration proceeding “was won in the president’s favor.” That led to news that Mr. Cohen had acquired a temporary restraining order against Ms. Clifford in late February.

Mr. Avenatti has been a regular presence on television, arguing that the restraining order and the original deal are both legally flawed, and making allegations aimed at undermining Mr. Cohen and Mr. Trump.

For instance, on Friday, Mr. Avenatti shared with NBC News and then ABC News that Mr. Cohen had conducted some negotiations with Ms. Clifford in 2016 on his Trump Organization email account. That, Mr. Avenatti told NBC, was at variance with Mr. Cohen’s previous statement that neither the Trump Organization nor the Trump campaign were “party to” the agreement with Ms. Clifford. Mr. Avenatti also suggested that the email cast doubt on Mr. Cohen’s assertion that he paid Ms. Clifford out of his own pocket.

Whether Mr. Trump ever reimbursed Mr. Cohen, and the extent to which he struck the deal in consultation with Mr. Trump, goes to the center of complaints the watchdog group Common Cause has made to the Federal Election Commission and the Justice Department alleging that the payment was an illegal campaign contribution.