The Donald J. Trump Foundation “has operated in persistent violation of state and federal law governing New York State charities” for more than a decade by, among other things, paying off legal bills with charitable funds, the New York Attorney General’s Office said in a lawsuit it filed Thursday.

The lawsuit accused President Trump -- along with his children Donald Jr., Eric and Ivanka -- of conflating charity with politics, repeated and willful self-dealing and failure to follow basic fiduciary obligations.

Filed in state Supreme Court by the attorney general's Charities Bureau, the suit seeks to dissolve the private New York-based foundation and prevent the Trumps from serving as directors of any nonprofits in the future.

The lawsuit alleges that President Trump used charitable assets to pay off his legal bills, promote Trump hotels and purchase personal items over the past decade.

“The Trump Foundation was little more than a checkbook for payments from Mr. Trump or his businesses to nonprofits, regardless of their purpose or legality,” Attorney General Barbara Underwood said in a statement. “This is not how private foundations should function.”

The president quickly defended the charity, tweeting, “the sleazy New York Democrats, and their now disgraced (and run out of town) A.G. Eric Schneiderman, are doing everything they can to sue me on a foundation that took in $18,800,000 and gave out to charity more money than it took in, $19,200,000,” in reference to the former state attorney general.

The most potentially damning allegation involved then-candidate Trump’s fundraiser that he staged instead of participating in a primary debate in Iowa in January 2016. The attorney general’s office said it unearthed an email from then-campaign manager Corey Lewandowski dictating the timing, amounts and recipients of grants.

The lawsuit said “at least five $100,000 grants were made to groups in Iowa in the days immediately before the Feb. 1 Iowa caucuses.”

In a statement, the Trump Foundation said, “This is politics at its very worst. The Foundation has donated over $19 million to worthy charitable causes – more than it even received. The President himself – or through his companies - has contributed more than $8 million. The reason the Foundation was able to donate more than it took in is because it had little to no expenses. This is unheard of for a charitable foundation. The Foundation currently has $1.7 million remaining which the NYAG has been holding hostage for political gain.

"This is unconscionable – particularly because the Foundation previously announced its intention to dissolve more than a year and a half ago. The prior NYAG, who was recently forced to resign from office in disgrace, made it his stated mission to use this matter to not only advance his own political goals, but also for his own political fundraising. The acting NYAG’s recent statement that battling the White House is ‘the most important work [she] have ever done’ shows that such political attacks will continue unabated.”