New York's attorney general is suing the Trump Foundation, as well as Donald Trump and his children, alleging "extensive and persistent" lawbreaking.
Barbara Underwood said the charitable foundation had engaged in "unlawful political co-ordination" designed to influence the 2016 election.
The lawsuit seeks to dissolve the foundation and $2.8m (£2.1m) in restitution.
The foundation denied the charges, calling them politically motivated.
The president hit back at the lawsuit on Twitter, saying that "sleazy New York Democrats" were "doing everything they can to sue me". He vowed he would not settle the case.
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
The attorney general is also seeking to bar the president and three of his adult children, Donald Jr, Eric and Ivanka, from serving on the board of any New York-based charity, "in light of misconduct and total lack of oversight".
She has referred the case to the Internal Revenue Service and the Federal Election Commission, she says.
What is the state attorney general alleging?
Ms Underwood filed a petition at the New York Supreme Court in Manhattan on Thursday, Mr Trump's 72nd birthday.
It accuses the foundation and its directors - Mr Trump and his three eldest children - of unlawfully co-ordinating with the Trump presidential campaign, repeated self-dealing transactions, and violating laws under which non-profit organisations must operate.
In a statement, Ms Underwood said Mr Trump had illegally instructed the foundation to provide support to his presidential campaign by using the foundation's name and funds it raised to promote the campaign.
The petition also claims that Mr Trump used charitable assets to pay off legal obligations, to promote his own businesses and to purchase personal items, including a painting of himself.
We are suing the Donald J. Trump Foundation and its directors @realDonaldTrump, Donald J. Trump Jr., Ivanka Trump, and Eric Trump for extensive and persistent violations of state and federal law. https://t.co/aP2ui0tOTo pic.twitter.com/geSMA3fx2x— New York Attorney General (@NewYorkStateAG) June 14, 2018
What have the Trump Foundation and the Trumps said?
The Trump Foundation issued a statement denying the charges and accusing the attorney general of holding its $1.7 million in remaining funds "hostage for political gain".
Ms Underwood is a Democrat.
The president described the suit as "ridiculous".
The younger Trumps have yet to comment publicly.
How did this come about?
The lawsuit announced on Thursday is the culmination of a two-year investigation, which began under the previous New York attorney general, Eric Schneiderman, Ms Underwood said.
Mr Schneiderman resigned last month after several former girlfriends accused him of physical abuse.
In October 2016 Mr Schneiderman ordered the Trump Foundation to stop fundraising in New York, after finding it had no proper registration.
President-elect Trump vowed to shut the charitable foundation down in December 2016, to avoid "even the appearance" of any conflict of interest.
The Trump Foundation lawsuit adds to Mr Trump's legal challenges, which include a wide-ranging special counsel investigation into alleged ties between the Trump campaign and Russia. Special Counsel Robert Mueller has indicted several of Mr Trump's associates and raided the home and office of the president's long-time lawyer and fixer, Michael Cohen.
'A new front opened up'
Anthony Zurcher, North America reporter
New York Attorney General Barbara Underwood has opened a new front in the ongoing criminal investigations into Donald Trump and his empire. Allegations of misdeeds connected to the Trump Foundation had swirled during the 2016 presidential elections, but the topic had been overshadowed during the early days of the Trump presidency. That may be about to change.
Administration officials, from the president on down, will certainly attempt to brand this as yet another politically motivated investigation of an ideological adversary - new witches but the same hunt.
Nevertheless, as New York Attorney General, Ms Underwood has significant investigatory and prosecutorial power, and if she starts looking into some of Mr Trump's more questionable charitable activities, there's no telling what she might turn up.
At the very least, it appears the Trump world's celebrations of former Attorney General Eric Schneiderman's disgrace were a bit premature. Ms Underwood may not be as outspokenly anti-Trump as her predecessor, but she appears to be equally - or more - aggressive where it counts, in the courtroom.
What details emerged in the court filing?
Thursday's 41-page document filed with the NY Supreme Court spells out a range of alleged violations of laws concerning non-profit organisations, dating back more than a decade.
The investigation apparently found that the foundation was "little more than an empty shell that functions with no oversight by its board of directors". The board had not met since 1999, despite being legally required to meet annually, and did not oversee the foundation's activities "in any way", the document says.
Mr Trump, who has not contributed any personal funds to the foundation since 2008, was the sole signatory on the foundation's bank accounts and approved all of its grants.
Several pages of the document focus on a charity fundraiser for veterans in Iowa in January 2016, which Mr Trump chose to hold instead of taking part in a TV debate with other Republican presidential hopefuls ahead of the influential state's caucuses.
More than $2.8m was donated to the Trump Foundation at that event. The petition alleges that those funds raised from the public were used to promote Mr Trump's campaign for the presidency, in particular in the Iowa nominating caucuses.
The lawsuit also claims that the foundation paid $100,000 (£75,000) to settle legal claims against Mr Trump's Mar-A-Lago resort, $158,000 to settle claims against one of his golf clubs, and $10,000 to purchase a painting of Mr Trump to hang at another of his golf clubs.
The purchase of the painting was an example of one of "at least five self-dealing transactions" which violate tax regulations on non-profit charities, the statement said.
"As our investigation reveals, the Trump Foundation was little more than a cheque book for payments from Mr Trump or his businesses to nonprofits, regardless of their purpose of legality," Ms Underwood said.
"This is not how private foundations should function."