NEW YORK (Reuters) - The New York state attorney general sued U.S. President Donald Trump, three of his children and his foundation on Thursday, saying he illegally used the nonprofit as a personal “checkbook” for his own benefit, including his 2016 presidential campaign.

Barbara Underwood, the attorney general, asked a state judge to dissolve the Donald J. Trump Foundation and to ban Trump, his sons Donald Jr. and Eric, and his daughter Ivanka from holding leadership roles in New York charities. The three children joined the foundation’s board in 2006, although Ivanka stepped down to work at the White House in 2017.

Underwood said her office’s 21-month investigation, begun under her predecessor Eric Schneiderman, uncovered “extensive unlawful political coordination” by the foundation with Trump’s campaign, as well as “repeated and willful self-dealing” to benefit Trump’s personal, business and political interests.

Among the transactions the lawsuit cited as illegal was a $10,000 payment to the Unicorn Children’s Foundation for a portrait of Trump purchased at a fundraising auction in 2014. The portrait would end up decorating a wall at Trump’s Doral golf resort near Miami, the Washington Post reported.

Another $100,000 went to another charity in 2007 to settle a legal dispute over a flagpole erected in violation of local ordinances at Mar-a-Lago, Trump’s private club and sometime residence in Palm Beach, Florida.

"Mr. Trump ran the Foundation according to his whim, rather than the law," the lawsuit on.ny.gov/2lbdv0V said.

The lawsuit, filed on Trump’s 72nd birthday in the state Supreme Court in Manhattan, seeks $2.8 million of restitution plus penalties, a 10-year ban on Trump serving as a director of a New York nonprofit, and one-year bans for his children.

“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. “That is not how private foundations should function.”

The foundation had no employees, had never written a required protocol for disbursing funds and its board of directors, which “existed in name only,” had not met since 1999, the lawsuit said.

The Republican president attacked the lawsuit in a series of posts on Twitter that blamed Democratic politicians in his home state.

“I won’t settle this case!” Trump wrote, calling the lawsuit ridiculous and engineered by “sleazy New York Democrats.”

During the 2016 presidential race, Trump frequently derided a charity run by the family of his Democratic rival, Hillary Clinton, saying without proof that the former secretary of state gave favorable treatment to the Clinton Foundation’s wealthy donors.

Both Clinton and the Clinton Foundation, best known for helping to lower the cost of HIV drugs in the developing world, dismissed those attacks as political mudslinging.

The Trump Foundation issued a statement criticizing the latest lawsuit as “politics at its very worst” and accusing the attorney general of holding its $1.7 million in remaining funds “hostage for political gain.”

The New York City-based foundation said in a statement it had disbursed more than $19 million to “worthy charitable causes” since its founding in 1987. Trump himself had contributed more than $8 million, and the foundation had already announced its intention to dissolve in 2016, the statement said.

FUNDRAISER FOR VETERANS

The lawsuit adds to Trump’s legal problems, including an investigation by Special Counsel Robert Mueller into whether his 2016 campaign colluded with Russia. Trump has denied there was any collusion, and Russia has denied meddling in the election.

U.S. President Donald Trump smiles next to North Korean leader Kim Jong Un (not pictured) at the Capella Hotel on Sentosa island in Singapore June 12, 2018. Kevin Lim/The Straits Times via REUTERS

The lawsuit challenges the Trump Foundation’s role in an Iowa fundraiser for military veterans that Trump organized in 2016 instead of taking part in one of the Republican debates.

Some $2.8 million went to the foundation, the lawsuit said, and the foundation wrongly ceded control of those funds to Trump’s campaign staff, who wrongly disbursed grants at campaign rallies for Trump’s political benefit. Tax-exempt nonprofit groups are legally required to avoid partisan politics.

The lawsuit said Corey Lewandowski, then Trump’s campaign manager, directed some of the funds to be disbursed in Iowa shortly before its caucuses, where voters from the state gather in the first electoral competition to choose parties’ presidential nominees. Lewandowski, who is not a target of the lawsuit, did not respond to a request for comment.

Paul S. Ryan, head of litigation at Common Cause, a nonpartisan watchdog group in Washington, said the New York filing provides details of actions that could also violate a federal ban on campaigns funneling “soft money” through nonprofits.

“This involvement of the Trump campaign in the foundation’s disbursements right before the Iowa caucuses may very well violate the campaign finance law soft money ban,” Ryan said in an interview.

The attorney general said she also sent letters about possible breaches of federal law to the Federal Election Commission (FEC) and Internal Revenue Service. Both agencies declined to comment.