U.S. President Donald Trump's namesake charitable foundation has agreed to dissolve following a lawsuit by New York's attorney general claiming Trump misused the foundation to advance his 2016 presidential campaign and his businesses, the state attorney general announced Tuesday.

Barbara Underwood said the Trump Foundation's assets will be distributed to charities that will be vetted by her office. The deal must still be approved by a state judge.

"Our petition detailed a shocking pattern of illegality involving the Trump Foundation, including unlawful co-ordination with the Trump presidential campaign, repeated and wilful self-dealing, and much more," Underwood said in a statement.

The ruling came less than a month after Justice Saliann Scarpulla of the New York State Supreme Court in Manhattan rejected Trump's motion to dismiss Underwood's lawsuit.

The motion had argued that the U.S. Constitution immunized Trump from Underwood's claims alleging breach of fiduciary duty, improper self-dealing and misuse of assets belonging to the foundation.

The attorney general's office in June, after what it said was a 21-month probe, sued the charity and its directors — Trump and his children Donald Trump Jr., Eric Trump and Ivanka Trump.​ The lawsuit sought $2.8 million US in restitution plus additional unspecified penalties.

Underwood said at the time she had also referred her findings to the IRS and the Federal Election Commission.

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

<a href="https://twitter.com/hashtag/BREAKING?src=hash&ref_src=twsrc%5Etfw">#BREAKING</a>: We’ve secured a stipulation requiring the Trump Foundation to dissolve under judicial supervision, with our review of recipient charities.<br><br>The Foundation functioned as little more than a checkbook to serve Mr. Trump’s interests. Our lawsuit remains ongoing. <a href="https://t.co/FsRubdNZs9">pic.twitter.com/FsRubdNZs9</a> —@NewYorkStateAG

While not mentioning Underwood by name, Trump has assailed the investigation as being politically motivated.

Underwood took over her position from Eric Schneiderman, a frequent Trump foil who was forced to resign from office after allegations of domestic abuse.

"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 [US] and gave out to charity more money than it took in, $19,200,000," said Trump in a June tweet. "I won't settle this case!"

Trump also pledged to fight a lawsuit accusing his now-shuttered Trump University of fraud, but ultimately agreed to pay a $25-million US settlement in 2017.

Investigations swirling

The charity investigation is one of a number of fronts in which Trump's political and business dealings are under scrutiny.

The attorneys general of Maryland and the District of Columbia have followed suit, alleging Trump violated the constitution by retaining ties to a sprawling global business empire.

It is alleged Trump's leases, properties and other business "entanglements" around the world pose a conflict of interest under a clause of the constitution.

Trump and his lawyers have argued the emoluments clause of the constitution does not cover fair-value transactions, such as hotel room payments and real estate sales.

Most recently, the Wall Street Journal reported that the Trump inauguration committee spending is being probed. The money raised from donations dwarfs that of previous inaugurations, and the paper reported there are questions as to whether the money was spent in some cases to obtain access to the incoming administration.

Politically, Trump's most pressing challenges involve the special counsel's investigation into co-ordination between the Russian government and individuals associated with the Trump campaign and transition team.

On Tuesday, Trump's former national security adviser, Michael Flynn, was in a D.C. courtroom preparing to be sentenced for lying to the FBI.

Flynn is one of several men in Trump's orbit who have been convicted of various criminal offences by authorities, including his former 2016 campaign chair, Paul Manafort, and his longtime personal lawyer, Michael Cohen.