(CNN) A New York state judge ordered President Donald Trump to pay $2 million to a collection of nonprofit organizations in connection with a settlement with the New York state attorney general's office to resolve a civil lawsuit alleging the foundation unlawfully coordinated with the 2016 Trump presidential campaign.

In her decision filed Thursday, Justice Saliann Scarpulla found that "Mr. Trump breached his fiduciary duty to the Foundation," including by "allowing his campaign to orchestrate" a televised fundraiser ostensibly for the foundation in Des Moines, Iowa, in January 2016, and allowing the campaign to direct the distribution of the money raised from that event "to further Mr. Trump's political campaign."

In her decision, however, the judge didn't impose one of the outcomes the attorney general's office sought: a ban on Trump and his children serving on the board of any other New York nonprofit. She also declined to order Trump to pay punitive damages.

The order and settlement bring an end to questions that first arose during the 2016 campaign about whether Trump used money raised under the guise of charitable work for political gain. The resolution puts the President in the unusual position of having to pay millions in damages while in office, at a time when he faces a large number of other personal legal battles.

Filed in June 2018, the lawsuit alleged that the President and his three eldest children -- Don Jr., Ivanka and Eric -- violated federal and state campaign finance laws and abused the Donald J. Trump Foundation's tax-exempt status. According to the lawsuit, the Trumps allowed the foundation to be used "as little more than a checkbook to serve Mr. Trump's business and political interests."

The attorney general's office had sought several outcomes, including $2.8 million in restitution, plus penalties. Trump himself had vowed to fight the lawsuit, tweeting last year, "I won't settle this case!"

But the lawyers on both sides, however, came to a "consensual resolution of the bulk of this proceeding" in October, the judge said in her decision, and agreed that the judge would determine the amount of damages Trump would be required to pay.

Trump said in a statement Thursday night that "the New York Attorney General is deliberately mischaracterizing this settlement for political purposes" and that all money in the foundation has gone to charity.

"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.

The settlement comes in the wake of an agreement by the foundation in December to dissolve under judicial supervision.

"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," Attorney General Letitia James said in a statement. "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."

As part of the settlement, Trump also agreed to reimburse $11,525 to the foundation for its payment of auction items at a charitable benefit and to comply with certain restrictions if he wants to join the board of another New York charity. Those restrictions include 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 the judge approved to 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.

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.

"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," said attorneys for the foundation, Alan Futerfas and Marc Mukasey. "Now that this matter is concluded, the Trump Foundation is proud to make this additional contribution."

As they had earlier in the case, Trump's attorneys on Thursday also described the lawsuit as "politically motivated," an accusation the attorney general's office has disputed.