A long legal saga for Steve Bannon, a longtime adviser to President Donald Trump, ended Tuesday when he pleaded guilty in Manhattan criminal court to a single felony count of defrauding donors who had sought to help build a wall at the southern border.

Bannon had been charged by the Manhattan district attorney’s office with five felony counts, including money laundering and conspiracy charges, and could have faced between five and 15 years in prison on the most serious charge. Instead, he received a three-year conditional discharge, meaning he will serve no prison time if he does not reoffend.

It was the second time Bannon had avoided a trial on charges connected to a group called We Build the Wall, a seeming grassroots effort to fulfill a key promise of Trump’s first term. In 2021, in the hours before he left office, Trump pardoned Bannon in a similar federal case.

To build the state case, the district attorney’s office would likely have needed to depend on those federal prosecutors, the documents they had gathered and the evidence they had presented to a federal grand jury in Manhattan.

But those officials now answer to an attorney general, Pam Bondi, who has pledged to scrutinize Manhattan District Attorney Alvin Bragg, who won a felony conviction of Trump last year.

Last week, Bondi said Bragg’s case would be reviewed by a Justice Department working group aimed at rooting out “abuses of the criminal justice process.” There is no indication that Bragg’s case against Trump violated the law.

Bannon’s lawyer, Arthur Aidala, celebrated the deal Tuesday. He said that had his client gone to trial as scheduled in March, he would have been hard pressed to win an acquittal before a Manhattan jury. Bannon’s co-defendants in the federal case were sentenced to years behind bars.

Bannon “always put up a fight,” Aidala said, “but he realized that maybe this was a fight, because of the forum he was in, that he was never going to win.”

In the courtroom Tuesday, Bannon appeared in his standard brown jacket, surrounded by his legal team. He sat quietly among the three lawyers, answering only “Yes, your honor” as Judge April A. Newbauer asked him about his understanding of the deal and the rights he was surrendering, including his right to appeal.

Bannon declined to address the court before he was sentenced.

Bragg said in a statement that the deal had achieved “our primary goal: to protect New York’s charities and New Yorkers’ charitable giving from fraud.”

He noted that under the terms of the deal, Bannon could not serve as an officer or director in charitable associations with assets in New York state and added, “New York has an important interest in rooting out fraud in our markets, our corporations and our charities, and we will continue to do just that.”

Bragg did not address the question of relying on federal law enforcement officials who might no longer be permitted to cooperate.

The plea marked a stunning end to a case that had wound through Manhattan courts for more than two years, punctuated by delays, teams of Bannon’s lawyers being replaced and accusations from him that prosecutors had been “vindictive” in charging him.

An influential right-wing media figure, Bannon was an architect of Trump’s 2016 election victory and served as a White House strategist. He also worked with We Build the Wall, a nonprofit that raised millions using social media.

In 2020, federal prosecutors charged Bannon and several co-conspirators in relation to the scheme. The co-conspirators, including the group’s president, Brian Kolfage, did not receive pardons from Trump, and were ultimately sentenced to prison.

A year after Bannon was pardoned, state prosecutors in Manhattan brought their own case.