A New York state judge ordered President Donald Trump to pay $2 million to several nonprofit organizations as fine for misusing his own charitable organization during his 2016 presidential campaign.

Judge Saliann Scarpulla imposed the fine after the president admitted to a series of allegations outlined in a lawsuit brought against him in 2018 by the New York attorney general’s office.

In a legal filing, Trump recognized that his presidential campaign staff had coordinated with the Trump Foundation to host a televised fundraiser for veterans right before the 2016 Iowa caucuses. The event was designed “to further Mr. Trump’s political campaign,” Scarpulla said.

However, Scarpulla declined to impose any punitive damages and did not ban Trump or his children from serving on the board of any other New York nonprofit — a punishment the attorney general had sought.

The lawsuit, which was filed in June 2018, alleged that Trump and his three eldest children violated federal and state campaign finance laws and abused the foundation’s tax-exempt status. The lawsuit said the Trumps used the foundation “as little more than a checkbook to serve Mr. Trump’s business and political interests.”

In a statement Thursday night, Trump said, “the New York Attorney General is deliberately mischaracterizing this settlement for political purposes.”

SLIDESHOW: TOP DEMOCRATS RUNNING FOR PRESIDENT IN 2020

“I am the only person I know, perhaps the only person in history, who can give major money to charity ($19M), charge no expense, and be attacked by the political hacks in New York State. No wonder why we are all leaving!” he said.

Among other offenses, the president admitted to using the charity to pay for a $10,000, 6-foot portrait of him and directing $100,000 in foundation money towards settling legal claims over an 80-foot flagpole he had built at his Mar-a-Lago resort in Florida. As part of the settlement, Donald Trump Jr. reimbursed the Trump Foundation for the cost of the portrait.

Trump also agreed to adhere to certain restrictions if he wants to join the board of another New York charity, including that the majority of the board members of the charity must not be Trump’s family members or have any business relationship with him, his companies or any companies owned by his relatives.

The list of nonprofits that will receive Trump’s $2 million include the 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 US Holocaust Memorial Museum.

The settlement comes almost a year after the Trump Foundation agreed to dissolve and disperse its assets under court supervision.

Those organizations will also receive equal portions of the charity’s remaining liquid assets, which total roughly $1.8 million, according to the judge’s order.