New York’s attorney general filed suit Thursday against the Donald J. Trump Foundation and its directors, including the president and three of his children, alleging the foundation was inappropriately used for self-gain.

“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,” state Attorney General Barbara Underwood said. “This is not how private foundations should function.”

Underwood said authorities found evidence that the foundation “raised in excess of $2.8 million in a manner designed to influence the 2016 presidential election at the direction and under the control of senior leadership of the Trump presidential campaign.”

The president slammed the suit in a pair of tweets Thursday, writing that “New York Democrats ... are doing everything they can to sue me,” and vowing not to settle.

Underwood's predecessor, Democrat Eric Schneiderman, began investigating the foundation in 2016 following Washington Post reports that its spending personally benefited the presidential candidate. Schneiderman ordered the foundation to stop fundraising in New York. He resigned last month after allegations that he abused women he had dated surfaced. He denied the claims.

Investigators said in a 41-page petition filed in court Thursday that Trump campaign manager Corey Lewandowski strategically ordered that foundation grants be given to nonprofit organizations in Iowa ahead of the 2016 Iowa caucuses. At least five $100,000 grants were given to Iowa nonprofits at Lewandowski's behest, according to authorities.

Investigators said Trump also used foundation funds to pay off his legal obligations and to promote Trump hotels and businesses.

The president is accused of using at least $258,000 of the foundation’s money to settle legal claims against his Mar-A-Lago resort and the Trump National Golf Club. Authorities said he also used $10,000 to buy a painting of himself at a charity auction.

Trump repaid the funds after authorities launched their probe of the Trump Foundation, Underwood said.

None of the payments were approved by the foundation’s board of directors, which includes the president’s children Donald Trump Jr., Ivanka Trump and Eric Trump, officials said. The board has not met since 1999, according to Underwood.

The Associated Press contributed to this report.