The Donald J. Trump Foundation agreed to be dissolved on Tuesday after it was accused of acting “in a persistently illegal manner” by the New York Attorney General’s Office.

The foundation is accused by the attorney general in a lawsuit—and in multiple news stories—of using charity funds to settle private business matters, coordinating between the foundation and Trump’s 2016 presidential campaign, and making an illegal and undisclosed contribution to a political action committee.

“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. This amounted to the Trump Foundation functioning as little more than a checkbook to serve Mr. Trump’s business and political interests,” Attorney General Barbara Underwood said in a statement. “This is an important victory for the rule of law, making clear that there is one set of rules for everyone.”

In a stipulation signed by foundation attorney Alan Futerfas, the foundation agreed to dissolve and within 30 days submit to the court a list of not-for-profit organizations to receive its remaining assets.

The stipulation follows a decision last month to allow for Underwood’s suit against the Trump Foundation to proceed. The lawsuit seeks $2.8 million in restitution plus penalties, as well as a ban on Trump from future service as a director of a New York not-for-profit for ten years. It also seeks the same ban for a year for Trump’s children, Donald Jr., Ivanka, and Eric, who all are foundation board members.

The lawsuit filed in June alleged that the foundation had illegally intervened “in Mr. Trump's campaign for president in 2016 by, among other things, making expenditures during the first five months of 2016 that were intended to influence his election for president.”

The A.G.’s office documented coordination between the campaign and the foundation, including an instance in which then-Trump campaign manager Corey Lewandowski requested that an official with the foundation give out grant money in Iowa in order to help the campaign win the state’s caucus.

Additionally, the lawsuit discusses a widely publicized veterans fundraiser in Des Moines held by the Trump Foundation, but allegedly staffed by the campaign, which “planned, organized, financed, and directed" it.

“The Fundraiser, which solicited donations from members of the public, including New York residents, reaped approximately $5.6 million in tax free donations,” the suit reads. “Of that total, $2.823 million was contributed to the Foundation.”

The complaint also said that in 2013, the Trump Foundation illegally donated $25,000 to a political action committee supporting the campaign of Florida Attorney General Pam Bondi. In its tax filing, it left out the contribution and instead listed a fictitious contribution to a similarly named non-profit outfit in Kansas.

The suit followed reporting throughout 2016 by the Washington Post and other outlets detailing how the foundation was used as Trump’s personal piggybank.