NEW YORK — President-elect Donald Trump was sentenced Friday to no punishment in his historic hush money case, a judgment that lets him return to the White House unencumbered by the threat of a jail term or a fine.

With Trump appearing by video from his Florida estate, the sentence quietly capped an extraordinary case rife with moments unthinkable in the U.S. only a few years ago.

It was the first criminal prosecution and first conviction of a former U.S. president and major presidential candidate. The New York case became the only one of Trump’s four criminal indictments that has gone to trial and possibly the only one that ever will. And the sentencing came 10 days before his inauguration for his second term.

In roughly six minutes of remarks to the court, a calm but insistent Trump called the case “a weaponization of government” and “an embarrassment to New York.” He maintained that he did not commit any crime.

“It’s been a political witch hunt. It was done to damage my reputation so that I would lose the election, and, obviously, that didn’t work,” the Republican president-elect said by video, with U.S. flags in the background.

After the roughly half-hour proceeding, Trump said in a post on his social media network that the hearing had been a “despicable charade.” He reiterated that he would appeal his conviction.

Manhattan Judge Juan M. Merchan could have sentenced the 78-year-old to up to four years in prison. Instead, Merchan chose a sentence that sidestepped thorny constitutional issues by effectively ending the case but assured that Trump will become the first president to take office with a felony conviction on his record.

Trump’s no-penalty sentence, called an unconditional discharge, is rare for felony convictions. The judge said that he had to respect Trump’s upcoming legal protections as president, while also giving due consideration to the jury’s decision.

“Despite the extraordinary breadth of those protections, one power they do not provide is the power to erase a jury verdict,” said Merchan, who had indicated ahead of time that he planned the no-penalty sentence.

As Merchan pronounced the sentence, Trump sat upright, lips pursed, frowning slightly. He tilted his head to the side as the judge wished him “godspeed in your second term in office.”

Before the hearing, a handful of Trump supporters and critics gathered outside. One group held a banner that read, “Trump is guilty.” The other held one that said, “Stop partisan conspiracy” and “Stop political witch hunt.”

Manhattan District Attorney Alvin Bragg, whose office brought the charges, is a Democrat.