(Reuters) - U.S. President Donald Trump’s namesake charitable foundation has agreed to dissolve under court supervision, partially resolving a New York state lawsuit claiming he misused it to advance his 2016 presidential campaign and his businesses, the state attorney general said on Tuesday.

The lawsuit against the Donald J. Trump Foundation also seeks to recoup $2.8 million and ban Trump and his three eldest children from leadership roles in any other New York charity.

The agreement, which must be approved by a New York state judge, would give state Attorney General Barbara Underwood the power to vet the charities that receive the foundation’s remaining assets.

Underwood said in a statement that the foundation had served as “little more than a checkbook to serve Mr. Trump’s business and political interests,” and called the agreement “an important victory for the rule of law.”

Alan Futerfas, a lawyer for the Trumps, responded in a statement that the lawsuit had delayed the foundation’s plan to dissolve after Trump won the U.S. presidential election in November 2016.

He added that over the past decade, the foundation had distributed about $19 million, including $8.25 million of Trump’s personal money, to over 700 charitable organizations.

Trump, a Republican, has previously said on Twitter that Underwood’s lawsuit was a concoction by “sleazy New York Democrats.” In their motion to dismiss the case, the Trumps said it reflected Underwood’s “pervasive bias” against them.

Slideshow ( 2 images )

The new agreement came less than a month after Justice Saliann Scarpulla of the New York State Supreme Court in Manhattan rejected the motion to dismiss.

The motion had argued that the U.S. Constitution immunized Trump from Underwood’s claims alleging breach of fiduciary duty, improper self-dealing, and misuse of assets belonging to the Foundation.

Underwood sued Trump and his adult children Donald Jr., Eric and Ivanka on June 14, after a 21-month probe that she said uncovered “extensive unlawful political coordination” between the foundation and Trump’s campaign.

Underwood alleged, among other things, that Trump wrongly ceded control to his campaign of about $2.8 million donated to the foundation in a 2016 Iowa fundraiser for military veterans. Other challenged expenses included $100,000 to settle a dispute involving Trump’s Mar-a-Lago resort, and $10,000 for a portrait of Trump that was later hung at one of his golf clubs.