New York City rent stabilized tenants won a major victory when a federal appeals court ruled that their leases can’t be seized in bankruptcy and sold to pay off creditors.

The US Court of Appeals for the Second Circuit on Thursday reversed a lower court decision that a rent-stabilized lease could be sold like any other household asset to satisfy debts.

The precedent-setting case has been closely watched by tenant rights advocates and landlords as there are roughly one million rent stabilized units in New York City.

State law doesn’t specifically shield rent-stabilized leases from a forced sale in the event of bankruptcy, but the issue hasn’t really been tested in the courts until this case.

“We hold that section 282 (2) of the Debtor and Creditor Law (DCL) exempts a debtor-tenant’s interest in a rent-stabilized lease,” the appeals court said in a statement.

The case centered on Mary Veronica Santiago-Monteverde, who pays $703 a month for her East 7th Street two-bedroom apartment that she has lived in since 1963.

When her husband died in 2011, she fell behind on her debts and filed for bankruptcy.

In a deal with the court-appointed trustee of Santiago-Monteverde’s case — whose job is to marshal assets to pay creditors — the landlord agreed to pay her $23,000 in mostly credit card debt in exchange for regaining control of the lease.

Under the deal brokered by the trustee, the landlord, JVG Management, agreed to allow Santiago-Monteverde to stay in the apartment she shares with her son for the rest of her life and to keep her rent at $703 a month.

Her son, however, would not get to inherit the lease after she passed — a treasured right for many New Yorkers — prompting her to fight in court.

In the appeal, her attorneys argued “the lease is a local public assistance benefit.”

The appeals court decided “a bankruptcy trustee can’t sell her rights,” Thompson & Knight attorney Ira Herman, who wrote a brief for the New York City Bankruptcy Assistance Project, told The Post. “This decision helps a lot of needy New Yorkers.”

Judge Robert Smith, who dissented in the opinion, disagreed that a rent-stabilized lease is a form of public assistance.

“I do not think I have ever seen or heard the words ‘public assistance’ used to refer to such a program [rent stabilization] before this case, and the majority cites no example of such a use.”