LOS ANGELES (AP) — A year ago, Michael Avenatti’s star was rising as the combative, media-savvy lawyer representing porn actress Stormy Daniels in her legal battles against President Donald Trump.

He hammered the president as a regular fixture on cable news and baited and bashed critics on Twitter while flirting with his own run for the White House.

Those days seemed like a distant memory as Avenatti was arrested Monday and federal prosecutors on both coasts announced charges that could send him to prison for the rest of his life.

Avenatti tried to shake down Nike for as much as $25 million by using his prominent position to threaten the company with bad publicity, federal prosecutors said. He was also accused of stealing a client’s settlement money to pay his own expenses and filing fake tax returns to get $4 million in loans from a Mississippi bank to fund a lavish lifestyle.

He was arrested at a New York law firm where he had gone to meet with Nike executives. It was just minutes after he tweeted that he planned to hold a news conference Tuesday to “disclose a major high school/college basketball scandal perpetrated by @Nike that we have uncovered.”

“When lawyers use their law licenses as weapons, as a guise to extort payments for themselves, they are no longer acting as attorneys. They are acting as criminals,” said Geoffrey S. Berman, the U.S. attorney in New York.

Prosecutors in New York said their investigation began only last week while California investigators had been building a tax case against Avenatti for more than a year.

The allegations “paint an ugly picture of lawless conduct and greed,” said U.S. Attorney Nick Hanna in Los Angeles. Avenatti describes himself on Twitter as “fighter for good,” but the accusations describe “a corrupt lawyer who instead fights for his own selfish interests.”

Avenatti, 48, was ordered released on $300,000 bond after a brief court appearance Monday evening in New York. He did not enter a plea. Emerging from the courthouse, he said he expected to be cleared of the charges.

“For the entirety of my career I have fought against the powerful. Powerful people and powerful corporations. I will never stop fighting that good fight,” he said. “I am highly confident that when all the evidence is laid bare in connection with these cases, when it is all known, when due process occurs, that I will be fully exonerated and justice will be done.”

Avenatti’s fame from the Daniels case made him a leading figure in the anti-Trump movement, with relentless cable news appearances, a hard-punching style and a knack for obtaining information about others’ wrongdoing.

His sharp reversal of fortune led critics to hit back on Twitter. Donald Trump Jr., whom Avenatti inaccurately predicted would be charged in the investigation into ties between his father’s 2016 presidential campaign and Russia, gloated.

“Good news for my friend @MichaelAvenatti, if you plead fast enough, you might just get to share a cell with Michael Cohen!” he wrote, referring to the former Trump lawyer set to go to prison next month for crimes that include orchestrating hush-money payments to Daniels. Trump Jr. mocked Avenatti by ending with the lawyer’s trademark hashtag #basta, an Italian word meaning “enough.”

Prosecutors said Avenatti and a co-conspirator initially approached Nike on behalf of a client who coached an Amateur Athletic Union basketball program sponsored by the company in California.

They claimed to have evidence of misconduct by Nike employees and threatened to hold a news conference last week on the eve of a company’s quarterly earnings call and the start of the NCAA tournament. Avenatti told Nike the company could either pay them $15 million to $25 million to investigate the allegations, or pay him more than $22 million for his silence, the criminal complaint said.

Two people familiar with the investigation confirmed the unidentified co-conspirator was Mark Geragos, a Los Angeles criminal defense lawyer known for his work with celebrities. The people spoke on condition of anonymity because the information was not made public by prosecutors.

Geragos, a CNN contributor, has a client list that has included Michael Jackson, Winona Ryder, Scott Peterson, Colin Kaepernick and most recently Jussie Smollett, the actor accused of fabricating a racist, anti-gay attack in Chicago. Geragos did not respond to messages seeking comment. Within hours, CNN cut ties with him.

While lawyers sometimes make demands to seek out-of-court settlements, it crosses the line to extortion if they threaten to go public with damaging information to get something of value or gain leverage in a civil dispute, attorney Neama Rahmani said.

“The Department of Justice historically has been very cautious when charging attorneys, so they likely have evidence that Avenatti seriously crossed this line,” said Rahmani, a former federal prosecutor.

Nike officials told investigators Avenatti claimed to know of rules violations by an amateur basketball team sponsored by Nike. Executives immediately reported the threats to federal authorities.

The company “firmly believes in ethical and fair play, both in business and sports, and will continue to assist the prosecutors,” Nike said in a statement.

Avenatti rose to national prominence by representing Daniels, whose real name is Stephanie Clifford, in a lawsuit to break a confidentiality agreement to speak about her alleged affair with Trump. He also made headlines in recent weeks representing two women who accused R&B star R. Kelly of sexual abuse.

Daniels said she was “saddened but not shocked” by the arrest. She issued a statement Monday on Twitter saying she fired Avenatti a month ago after “discovering that he had dealt with me extremely dishonestly.” She said she would not elaborate.

While Avenatti’s lawsuit effectively tore up the gag order that threatened financial penalties if Daniels spoke about the case, a defamation lawsuit filed on her behalf against Trump backfired, and a court ordered her to pay the president’s $293,000 in legal fees.

Avenatti himself has been dogged with tax and financial troubles in recent years.

A U.S. bankruptcy court ordered his former firm to pay $10 million to a lawyer who claimed it had misstated its profits.

The bank fraud case involved $4 million in loans he got from The Peoples Bank in Biloxi, which prosecutors said he obtained by filing fraudulent tax returns claiming $14 million in income over three years. However, he never filed tax returns those years, nor paid the $2.8 million he reported on the forms. In fact, he still owed more than $850,000 to the IRS at the time for previous income.

Mark Pearson, the assistant agent in charge of IRS criminal investigations in Los Angeles, said Avenatti’s crimes supported a $200,000-a-month lifestyle, a car racing venture and pricey homes in the wealthy Orange County communities of Newport Beach and Laguna Beach.

Convictions on all charges carry up to 47 years in the New York case and 50 years in the California case, prosecutors said.

___

Melley reported from Los Angeles. Associated Press writers Jim Mustian in New York, Michael Balsamo in Washington and John Antczak in Los Angeles also contributed to this report.