A judge Thursday ordered President Donald Trump to pay $2 million to settle a suit by New York’s attorney general alleging he misused his Trump Foundation charity to benefit his 2016 presidential campaign, in addition to other unlawful activity over more than a decade.

Manhattan Supreme Court Justice Saliann Scarpulla ruled that more than $2.8 million raised by the Trump Foundation had been “used for Mr. Trump’s political campaign and disbursed by Mr. Trump’s campaign staff, rather than by the Foundation” itself.

“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 in her ruling.

The Trump Foundation agreed to dissolve last December and donate its remaining funds to charity.

Trump tweeted out a statement late Thursday in which he claimed “the New York Attorney General is deliberately characterizing this settlement for political reasons.”

Scarpulla noted that the $2.8 million raised by the foundation had ultimately been delivered to the veterans’ charities for which the funds were intended. But she ordered Trump to pay $2 million, which would have otherwise gone to the foundation if it were still in existence, as damages in the case.

Notre Dame Law School Professor Lloyd Hitoshi Mayer, a tax-law and election specialist, said that such a large settlement is “highly unusual, especially when the funds at issue ultimately did go to veterans charities.”

The ruling “highlights the egregious nature of President Trump’s actions,” Mayer said.

Scarpulla also declined to impose punitive damages on Trump — which would have added millions to the settlement — because Trump had taken steps to ensure the alleged illegal activity would not occur again.

The lawsuit was filed in June 2018 by then New York  State Attorney General Barbara Underwood  against Trump and his three eldest children — Ivanka, Eric and Donald Jr. She alleged that the “pattern” of illicit behavior included “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.”

The lawsuit revolved in large part around a January 2016 fundraiser in Iowa to raise money for veterans that went to the Trump Foundation. Underwood accused the fundraiser of being used to influence Trump’s presidential campaign.

“Mr. Trump’s fiduciary duty breaches included allowing his campaign to orchestrate the Fundraiser, allowing his campaign, instead of the Foundation, to direct distribution of the Funds, and using the Fundraiser and distribution of the Funds to further Mr. Trump’s political campaign,” Scarpulla wrote in her ruling.

New York Attorney General Letitia James said Thursday in a statement: “The Trump Foundation has shut down, funds that were illegally misused are being restored, the president will be subject to ongoing supervision by my office, and the Trump children had to undergo compulsory training to ensure this type of illegal activity never takes place again.”

“The court’s decision, together with the settlements we negotiated, are a major victory in our efforts to protect charitable assets and hold accountable those who would abuse charities for personal gain,” James said. “My office will continue to fight for accountability because no one is above the law — not a businessman, not a candidate for office, and not even the President of the United States.”

The president has raged on Twitter about the civil suit, attacking “sleazy New York Democrats” and vowing, “I won’t settle this case!”

In a statement, a Trump Foundation spokesperson said Thursday that the charitable organization had intended to dissolve after the 2016 election, but that that plan was delayed by “the Attorney General’s politically motivated lawsuit”:

“The Trump Foundation is pleased to donate an additional $2 million to the following worthy organizations: Army Emergency Relief; Children’s Aid Society; City Meals-on-Wheels; Give an Hour; Martha’s Table; United Negro College Fund; United Way of Capital Area; and the U.S. Holocaust Memorial Museum. Since its inception in 1987, the Trump Foundation has distributed over $19 million to hundreds of worthwhile charities with little to no expenses. More than $9 million came directly from President Trump. Following the 2016 presidential election, the Trump Foundation publicly announced its intention to voluntarily dissolve and distribute all of its remaining funds to charity. Unfortunately, that donation was delayed due to the Attorney General’s politically motivated lawsuit. We are pleased that the Court, in rejecting the Attorney General’s frivolous request for statutory penalties, interest and other damages, recognized that every penny ever raised by the Trump Foundation has gone to help those most in need. Now that this matter is concluded, the Trump Foundation is proud to make this additional contribution.”