New York Attorney General Barbara Underwood sued President Donald Trump and his charitable foundation on Thursday, alleging that the president and his adult children illegally used it for personal, business, and political expenses.

The lawsuit alleges illegal activity that took place over more than a decade, including "extensive unlawful political coordination with the Trump presidential campaign, repeated and willful self-dealing transactions to benefit Mr. Trump's personal and business interests, and violations of basic legal obligations for nonprofit foundations," according to a statement from the attorney general's office.

The suit accuses the president, along with Ivanka Trump, Eric Trump and Donald Trump Jr., of violating multiple counts of state and federal law. The New York attorney general's office began looking into the Trump Foundation in the summer of 2016, following an investigation by The Washington Post into the then-candidate's philanthropy.

Trump boasted frequently of his personal generosity, but The Post found that his pledges were largely unverifiable and that his private charity was funded largely by others. The foundation frequently gave to causes that benefited Trump or his businesses in some way, The Post reported.

The lawsuit now alleges that certain contributions amounted to self-dealing: Foundation funds were used to pay off Trump-owned companies' legal obligations, including a $100,000 payment to a charity that was mandated in the settlement of a lawsuit between his private Mar-a-Lago club and the city of Palm Beach.

Charity funds were also used to purchase personal items (including a $10,000 painting of Trump that was displayed in a Trump building, another incident of self-dealing, according to the petition), and influence the president's 2016 campaign, the suit said.

Charitable organizations are strictly prohibited from getting involved in politics or influencing campaigns under federal law, but the suit alleges that from the days before the Iowa caucuses on, the campaign directed foundation resources.

Much of the petition's findings of wrongdoing stem from a fundraiser Trump threw in Iowa on the same day of a Republican presidential candidate debate he refused to attend because Megyn Kelly, then a Fox News host and now with NBC, was the moderator.

The hastily thrown-together event was a political stunt, casting Trump as a generous philanthropist and raising millions, while $2.83 million of the funds raised went to the Trump Foundation itself.

After that event, campaign staff directed the foundation's disbursement of funds and used the donations to support campaign endeavors, the suit alleges, and that money "provided Mr. Trump and the campaign a means to take credit" for the donations in a variety of ways for political gain.

Enlarged foundation checks — with the presidential candidate's name on them — were displayed at campaign events, and Trump boasted at one point of the effect the donations had on his poll numbers.

In one instance, the suit cites an email sent by Trump's then-campaign manager, Corey Lewandowski, telling the foundation to cut a $100,000 check to the Marine Corps Law Enforcement Foundation after a media inquiry about Trump's charitable donations. A check was sent to the group the same day.

In violation of state and federal law, senior Trump campaign staff, including Campaign Manager Corey Lewandowski, dictated the timing, amounts, and recipients of grants by the Foundation to non-profits. pic.twitter.com/7MnLbwDqlY — New York Attorney General (@NewYorkStateAG) June 14, 2018

Trump "was fully aware of and intended the benefit he would derive from the Foundation's in-kind contributions," the petition states, noting that Trump also had a financial interest in the campaign because he had loaned it millions of dollars.

"As our investigation reveals, 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," Underwood said in a statement. "This is not how private foundations should function and my office intends to hold the Foundation and its directors accountable for its misuse of charitable assets."

Ivanka, Eric and Donald Jr. were members of the foundation's board for years and had a fiduciary responsibility to ensure the proper handling of charitable funds, the suit alleges, but did not do so. In fact, the board had not met since 1999.

Trump responded on Twitter, unloading on former New York Attorney General Eric Schneiderman and vowing not to settle.

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. I won’t settle this case!... — Donald J. Trump (@realDonaldTrump) June 14, 2018

Schneiderman was on a state leadership council for the Clinton campaign, he did not manage it. His successor, Underwood, is a career civil servant who was appointed attorney general this spring after several women accused Schneiderman of physical abuse, leading to his resignation. Underwood has said she will not run as a candidate for a full term.

In a statement, the Trump Foundation called New York's lawsuit a "political attack."

"This is politics at its very worst," spokesman for the foundation said. "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 attorney general is seeking to dissolve the foundation under court supervision and obtain restitution of $2.8 million, plus additional penalties. It would also ban the president from serving as a director on a New York nonprofit for a decade, and ban Ivanka, Eric and Donald Jr. from doing the same for a year.

The attorney general has sent letters identifying potential violations to the Federal Elections Commission and the Internal Revenue Service, as well.