U.S. President Donald Trump's foundation served as a personal piggy bank for his businesses, legal bills and presidential campaign, New York's attorney general said Wednesday as she sued the charity and its directors — Trump and his children Donald Trump Jr., Eric Trump and Ivanka Trump.​

The Donald J. Trump Foundation "was little more than a chequebook for payments from Mr. Trump or his businesses to nonprofits, regardless of their purpose or legality," Democratic Attorney General Barbara Underwood said.

Trump ran the foundation according to his whim, rather than the law. - Lawsuit, filed by New York Attorney General Barbara Underwood

The lawsuit says the foundation illegally helped support the Republican's campaign by raising money at a nationally televised fundraiser in January 2016, then allowing campaign staffers to dictate how the money was spent in grants.

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

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, according to a report in the Washington Post.

The sleazy New York Democrats… are doing everything they can to sue me. - Donald Trump

Another $100,000 went to a different 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, Fla.

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, N.Y.; 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 made to satisfy a Trump company pledge to contribute to a land-preservation group.

"Trump ran the foundation according to his whim, rather than the law," the lawsuit claims.

"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."

Underwood asked a state judge to dissolve the foundation and to impose a 10-year ban on Trump and one-year bans on his children from serving as directors in New York charities. His children joined the foundation's board in 2006, although Ivanka stepped down to work at the White House in 2017.

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

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

The lawsuit, filed on Trump's 72nd birthday in the state Supreme Court in Manhattan, also seeks $2.8 million of restitution plus additional unspecified penalties and the dissolution of the foundation, which Trump has already vowed to dismantle

From left: Eric Trump, Ivanka Trump, Donald Trump and Donald Trump Jr. were all named in the New York attorney general's suit. (Timothy A. Clary/AFP/Getty Images)

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 foundation issued a statement criticizing the lawsuit as "politics at its very worst" and accused the attorney general of holding its funds "hostage for political gain."

Trump, in a series of tweets, denounced the case as "ridiculous" and saying he wouldn't settle the lawsuit.

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!... —@realDonaldTrump

....Schneiderman, who ran the Clinton campaign in New York, never had the guts to bring this ridiculous case, which lingered in their office for almost 2 years. Now he resigned his office in disgrace, and his disciples brought it when we would not settle. —@realDonaldTrump

Trump made a similar claim that he wouldn't settle a lawsuit charging that his Trump University misled customers, but ultimately paid a $25-million US settlement last year.

Trump also singled out Underwood's predecessor, Democrat Eric Schneiderman, in his tweets. Schneiderman began investigating the foundation in 2016 following Washington Post reports that foundation spending personally benefited the presidential candidate. Schneiderman ordered the foundation to stop fundraising in New York.

The Trump campaign, at the time, said the foundation intended to co-operate with the investigation. The campaign had previously called Schneiderman "a partisan hack" who backed Trump's 2016 Democratic rival, Hillary Clinton.

During the campaign Trump frequently derided a charity run by the Clinton family, saying without proof that the former secretary of state gave favourable 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.

Schneiderman resigned last month after allegations that he abused women he had dated; he denied the claims.

New York Attorney General Barbara Underwood, seen here speaking to legislative leaders in Albany, N.Y., on May 15, says the foundation was 'little more than a chequebook' for Trump or his businesses. (Hans Pennick/Associated Press)

The foundation's mission statement says its funds are to be used "exclusively for charitable, religious, scientific, literary or educational purposes," either directly or through other organizations, according to the court filing.

In keeping with federal tax rules, the charity's incorporation documents say none of its resources can directly or indirectly go to the benefit of its directors or officers, and none of its activities can benefit any political candidate, the filing notes.

Mounting legal problems

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.

The lawsuit challenges the 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.