A New York judge Friday upheld President-elect Donald Trump’s felony conviction but signaled that he was inclined to spare him any punishment, a striking development in a case that had spotlighted an array of criminal acts and imperiled the former and future president’s freedom.

The judge, Juan M. Merchan, indicated that he favored a so-called unconditional discharge of Trump’s sentence, a rare and lenient alternative to jail or probation. He set a sentencing date of Jan. 10, and ordered Trump to appear either in person or virtually.

An unconditional discharge would cement Trump’s status as a felon just weeks before his inauguration — he would be the first to carry that dubious designation into the presidency — even as it would water down the consequences for his crimes.

Unlike a conditional discharge, which allows defendants to walk free if they meet certain requirements, such as maintaining employment or paying restitution, an unconditional discharge would come without strings attached.

That sentence, Merchan wrote in an 18-page decision, “appears to be the most viable solution to ensure finality and allow defendant to pursue his appellate options.”Trump, who could ask an appeals court to intervene and postpone the sentencing, was facing up to four years in prison. A Manhattan jury convicted him in May on 34 counts of falsifying business records, concluding that he had sought to cover up a sex scandal that threatened to derail his 2016 campaign for president.

Merchan declined Friday to overturn the jury’s verdict, rebuffing Trump’s claim that his election victory should nullify his conviction. And last month, the same judge rejected another argument Trump had mounted in hopes of getting the case dismissed: that his conviction had violated a recent Supreme Court ruling granting presidents broad immunity for their official actions.

Together, Merchan’s two rulings picked apart Trump’s legal maneuvers, upholding the first criminal conviction of a U.S. president and denying him the opportunity to clear his record before returning to the White House.

“To dismiss the indictment and set aside the jury verdict would not serve the concerns set forth by the Supreme Court in its handful of cases addressing presidential immunity nor would it serve the rule of law,” Merchan wrote in Friday’s ruling. “On the contrary, such decision would undermine the rule of law in immeasurable ways.”

The judge added that “the sanctity of a jury verdict” was “a bedrock principle in our nation’s jurisprudence.”

The judge’s ruling does not guarantee that Trump will face sentencing Jan. 10 as planned. In the coming days, his lawyers could ask an appeals court to grant an emergency pause of the sentencing. The appeals court could then rule within a matter of hours.

Alternatively, the president-elect could decide not to fight the sentencing now that he knows the judge is unlikely to send him to jail.

There is some benefit to Trump’s choosing that route. Once sentenced, he is free to appeal his conviction and mount a drawn-out legal battle across his second presidential term.

Although New York appeals courts might resist his efforts, he may ultimately fare better at the Supreme Court, where the 6-3 conservative majority includes three justices whom Trump appointed in his first term.

In a statement Friday, a spokesperson for Trump did not say whether the president-elect would seek to pause the proceedings, although he suggested that the sentencing could become a distraction.

“President Trump must be allowed to continue the presidential transition process and to execute the vital duties of the presidency, unobstructed by the remains of this or any remnants of the witch hunts,” the spokesperson, Steven Cheung, said in the statement. “There should be no sentencing, and President Trump will continue fighting against these hoaxes until they are all dead.”

A spokesperson for the Manhattan district attorney’s office, which prosecuted Trump, declined to comment.

If the sentencing proceeds as planned, an unconditional discharge would mark a highly unusual conclusion to the landmark case.

A New York Times review of the 30 felony false-records convictions in Manhattan since 2014 revealed that no other defendant received an unconditional discharge. They instead received jail and prison sentences, probation, conditional discharges, community service or fines.

The lenient sentence would reflect the practical impossibility of jailing a president-elect or sitting president — or even holding the threat of jail over his head during his term.

It would also cap a stunning turnabout for Trump, who last year faced four criminal cases in four different jurisdictions, each carrying the threat of years in prison. Now, he is poised to avoid spending even a day behind bars, thanks to an election that returned him to the White House.

The federal special counsel who brought two of those cases — one in Washington, D.C., and the other in Florida — recently shut them down, yielding to a Justice Department policy prohibiting federal prosecutions of sitting presidents.

And in Georgia, where Trump is accused of trying to subvert the state’s 2020 election results, an appeals court disqualified the local prosecutor who brought the case, throwing it into disarray.

In New York, legal experts predicted that Trump would not have served more than a few weeks or months behind bars, even had he lost the election. Merchan had already paused his sentencing to accommodate Trump’s presidential campaign and, later, his effort to overturn the verdict in the wake of his victory.

The case against Trump stemmed from a hush-money deal struck in the final days of the 2016 presidential campaign with porn actor Stormy Daniels, who was threatening to go public with her account of a sexual liaison with Trump.

Michael Cohen, Trump’s fixer at the time, reached a $130,000 deal with Daniels to suppress that story. And then, according to prosecutors, Trump covered up his reimbursement of Cohen through payments falsely classified as ordinary legal expenses.

In May, after a seven-week trial, a jury of 12 New Yorkers found Trump guilty of 34 counts of falsifying those business records.