A New York judge Thursday ordered President Trump to pay $2 million from his own pocket for misusing his charitable foundation in a lawsuit filed by New York’s attorney general.

Manhattan Supreme Court Judge Saliann Scarpulla ruled the president used the Trump Foundation to promote his political and business interests, and signed off on closing the foundation and distributing its $1.7 million in assets to other nonprofit groups.

“A review of the record, including the factual admissions in the Final Stipulation, establishes that Mr. Trump breached his fiduciary duty to the foundation and that waste occurred to the foundation,” Scarpulla wrote. She declined to impose damages because Trump moved to prevent future illegal activity.

The foundation shut down last December, six months after the suit was filed.

State Attorney General Letitia James had sought $2.8 million in restitution and denied the suit was politically motivated, as Trump and foundation lawyers alleged.

The suit was filed by then-Attorney General Barbara Underwood in an investigation started by her predecessor, Eric Schneiderman, and named Trump’s three eldest children as well as the president. The suit alleged a pattern of illicit activity, including “improper and extensive political activity, repeated and willful self-dealing transactions, and failure to follow basic fiduciary obligations or to implement even elementary corporate formalities required by law.”

Shortly after the suit was filed, Trump lashed out on Twitter, blaming a previous attorney general and pledging never to settle.

Trump said he never took any expenses from the foundation and accused the state of New York of targeting him, using the attorney general’s office as a “bludgeoning tool” to file suits on everything “in search of a crime.”

The suit alleged the Trumps violated state and federal laws and unlawfully involved the foundation in Trump’s 2016 presidential campaign. It sought to ban Trump from serving on the boards of any other nonprofits for a decade and his children for at least a year.