New York's attorney general sued President Donald Trump and his foundation Thursday, accusing him of illegally using the charity's money to settle disputes involving his business empire and to boost his political fortunes during his run for the White House.

The president called the case "ridiculous."

The lawsuit against Trump and the foundation directors — his children Don Jr., Eric and Ivanka — seeks $2.8 million in restitution, additional unspecified penalties and the dissolution of the foundation, which Trump had already pledged to dismantle.

The attorney general's office detailed what it said was a closely coordinated effort by Trump's campaign and the foundation to burnish his political image by giving out big grants of other's people money to veterans' organizations during the run-up to the Iowa caucuses, the first presidential nominating contest of 2016.

"The foundation's grants made Mr. Trump and the campaign look charitable and increased the candidate's profile to Republican primary voters and among important constituent groups," Democratic Attorney General Barbara Underwood's lawsuit said.

It accused the foundation of "improper and extensive political activity, repeated and willful self-dealing transactions, and failure to follow basic fiduciary obligations."

Underwood referred her findings to the IRS and the Federal Election Commission for possible further action. IRS and FEC representatives declined to comment.

The Trump Foundation's mission says its funds are to be used "exclusively for charitable, religious, scientific, literary or educational purposes," according to the lawsuit.

In exchange for tax-exempt status, charities are required to follow rules that include a strict prohibition against involvement in political campaigns.

In tweets, Trump vowed: "I won't settle this case!"

He said former Attorney General Eric Schneiderman, who started the investigation, "never had the guts to bring this ridiculous case" before resigning last month after being accused of physically abusing women he dated. Schneiderman has denied the allegations.

Trump's foundation called the case "politics at its very worst," noting that Schneiderman, a Democrat, was a vocal Trump opponent. White House press secretary Sarah Huckabee Sanders, meanwhile, called Underwood "outrageously biased."

The 31-year-old foundation said that it has given more than $19 million to charitable causes while keeping expenses minimal, and that Trump and his companies have contributed more than $8 million.

Underwood is a career government lawyer who was appointed after Schneiderman's resignation. She has said she doesn't intend to run for election.

Schneiderman began investigating the charity in 2016, after The Washington Post reported that the foundation's spending personally benefited the presidential candidate. Some of the expenditures uncovered by The Post were cited in the lawsuit.

In a handwritten note, Trump directed that $100,000 in foundation money go to settle legal claims against Trump's Mar-a-Lago resort in Palm Beach, Florida, the lawsuit said.

The foundation also paid $158,000 to resolve a lawsuit over a prize for a hole-in-one contest at Trump National Golf Club in Briarcliff Manor, New York; $10,000 to buy a 6-foot (1.8-meter) portrait of Trump at a charity auction; and $5,000 for advertisements published in the programs for charitable events. The ads promoted Trump's hotels.

The suit also singled out a $32,000 payment that the foundation made to satisfy a Trump company pledge to contribute to a land-preservation group.

After New York's attorney general began investigating, Trump's business empire reimbursed the foundation for various payments and returned the painting to the foundation.

Despite the prohibition on political activity, Trump's foundation cut a $25,000 check in 2013 to Republican Florida Attorney General Pam Bondi's re-election campaign, the lawsuit notes. After a watchdog group complained to the IRS in 2016, Trump reimbursed the foundation and paid a $2,500 fine.

Then Trump's foundation was "co-opted" by his presidential campaign, the lawsuit says.

Four days before the Iowa caucuses, Trump held a televised rally and fundraiser for veterans' organizations. The event raised approximately $5.6 million, half of which went to the Trump Foundation; the rest was given directly by donors to veterans groups, the lawsuit says.

The foundation then gave campaign staff members control over the money raised, the attorney general charged.

"Is there any way we can make some disbursements this week while in Iowa?" then-campaign manager Corey Lewandowski wrote in an email.

Lewandowski did not immediately respond to a request for comment.

The foundation went on to make at least five grants of $100,000 each to Iowa groups before the caucuses, with Trump presenting giant checks at a series of campaign rallies. The checks bore Trump's "Make America Great Again" campaign slogan along with the foundation's address.

Trump didn't give any money personally at the time, but several months later, after media pressure, followed through on a pledge to donate $1 million.

During his campaign, Trump was highly critical of Democratic rival Hillary Clinton's family charity, the Clinton Foundation, for taking donations from people who met with her while she was secretary of state.

Whatever the claims against Trump's foundation, Iowa groups that got checks said Thursday they were grateful for the money.

Support Siouxland Soldiers used its $100,000 donation to open an emergency food pantry and provide clothing, haircuts and other services to veterans, founder Sarah Petersen said. She said she is not sure what to make of the lawsuit against Trump.

"I think people support a candidate based on lots of decisions and choices and positions on the issues," she said. "I don't know that giving a charity a donation would sway a lot of voters."