A judge on Thursday ordered President Trump to pay $2 million to a number of nonprofit organizations to settle a lawsuit brought by the New York state attorney general that claims he misused his now shuttered foundation to further his political interests.

The suit was filed in June 2018 by then-Attorney General Barbara Underwood and claimed the Trump family – including the president and his three eldest children, Donald Jr., Ivanka and Eric – allowed the foundation to be used as “little more than a checkbook to serve Mr. Trump’s business and political interests.”

It said the Donald J. Trump Foundation abused its tax-exempt status and violated federal and state campaign finance laws.

New York state Attorney General Letitia James was seeking a total of $2.8 million in restitution from the foundation, but State Supreme Court Judge Saliann Scarpulla cut that down to $2 million.

In the order, Scarpulla said that the president “breached his fiduciary duty” by allowing the foundation to stage a “Trump for Vets” charity event in Iowa before the state’s caucuses in 2016.

“As a director of the Foundation, Mr. Trump owed fiduciary duties to the Foundation… he was a trustee of the Foundation’s charitable assets and was thereby responsible for the proper administration of these assets,” Scarulla wrote.

The Iowa event brought in $5.6 million in tax-free donations, but half of it went into the foundation’s coffers to benefit the Trump presidential campaign while the other half went to charitable organizations.

“Trump used Foundation money, raised from the public, to demonstrate his purported generosity and attract votes,” James said in a statement.

Alan Futerfas, a lawyer representing the foundation that was shuttered last December, said the lawsuit was “politically motivated” and blamed it for delaying the foundation’s donating the money to charity.

“Now that this matter is concluded, the Trump Foundation is proud to make this additional contribution,” Futerfas said in a statement.

James said the court decision represents a “major victory in our efforts to protect charitable assets and hold accountable those who would abuse charities for personal gain.”

“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 statement continued.