Ten weeks ago, Michael Avenatti was a California lawyer known for his successes in class-action lawsuits. Then he sued President Trump on behalf of adult-film actress Stormy Daniels and — through an extraordinarily aggressive media campaign — parlayed a narrow dispute about a one-night stand into a ­news-cycle-dominating assault on the president of the United States.

The take-no-prisoners approach has turned Avenatti into a darling of the political left, which is hungry for anti-Trump heroes and gleeful at the notion that the president could be taken down by a porn star. Many of Avenatti’s fans believe he is just as likely to unearth damaging revelations about Trump as special counsel Robert S. Mueller III, who is leading the probe into Russian influence in the 2016 election.

To become one of Trump’s chief adversaries, Avenatti has carved a Trumpian path. He taunts his opponents. He uses Twitter to make explosive accusations. And he is omnipresent on cable news.

Yet Avenatti’s tactics and visibility may carry risks that could undermine his ability to represent his client, who is suing longtime Trump attorney Michael Cohen and the president to be released from a non-disclosure agreement. Scrutiny of his business record and of his motives has provided grist for distracting headlines in recent days. And his publication last week of Cohen’s banking history — hard-to-get information touching on some of the most sensitive issues before the White House — could jeopardize his ability to represent Daniels in court, some experts say.