President Donald Trump’s personal charity has agreed to shut down amid an ongoing ethics investigation into its finances, the New York attorney general announced on Tuesday.

The agreement follows a court ruling last month that a lawsuit filed against the Donald J. Trump Foundation by Attorney General Barbara Underwood in June will be allowed to move forward.

“Our petition detailed a shocking pattern of illegality involving the Trump Foundation — including unlawful coordination with the Trump presidential campaign, repeated and willful self-dealing, and much more,” Underwood said in a statement. “This amounted to the Trump Foundation functioning as little more than a checkbook to serve Mr. Trump’s business and political interests.”

ASSOCIATED PRESS President Donald Trump has agreed to dissolve the Trump Foundation after being accused of using it for his personal and political benefit.

As part of the agreement, the Trump Foundation will dissolve under judicial supervision. It will also be required to distribute any remaining charitable assets to reputable organizations approved by Underwood’s office.

Underwood’s lawsuit seeks millions in restitution and penalties. It also seeks to prevent Trump and his three eldest children ― Donald Trump Jr., Ivanka Trump and Eric Trump ― from serving on the boards of other New York charities.

The president vowed shortly after Underwood’s lawsuit was filed to fight the case, calling it the work of “sleazy New York Democrats.”

“I won’t settle this case!” he tweeted.

This is a developing story. Check back for updates.