President Trump paid more than $2 million in a court-ordered settlement to end a lawsuit in which he was accused of misusing funds at his charitable foundation for political gain.

The payment and the remaining $1.8 million in the Trump Foundation's bank account were distributed among eight charities, New York Attorney General (AG) Letitia James announced Tuesday.

Those charities are Army Emergency Relief, the Children’s Aid Society, Citymeals on Wheels, Give an Hour, Martha’s Table, the United Negro College Fund, the United Way of National Capital Area and the U.S. Holocaust Memorial Museum. Each received $476,140, James said.

TRUMP FOUNDATION AGREES TO DISSOLVE AFTER LAWSUIT ALLEGED 'ILLEGAL CONDUCT'

“Not only has the Trump Foundation shut down for its misconduct, but the president has been forced to pay $2 million for misusing charitable funds for his own political gain," James said in a statement.

The lawsuit filed in June 2018 accused Trump and his three eldest children of using the Donald J. Trump Foundation to boost Trump's 2016 presidential campaign, settle legal disputes and for the purchase of sports paraphernalia, among other items.

NY AG PROMISES TO 'USE EVERY AREA OF THE LAW' TO PROBE TRUMP, FAMILY

Last month, a judge ordered Trump to pay $2 million in damages. James' office had originally pushed for $2.8 million in restitution and a $5.6 million penalty. As part of the settlement, Trump admitted to misusing Trump Foundation funds and agreed to limitations and restrictions on future charitable work.

"Charities are not a means to an end, which is why these damages speak to the president’s abuse of power and represent a victory for not-for-profits that follow the law," James said. "My office will continue to fight for accountability because no one is above the law -- not a businessman, not a candidate for office, and not even the president of the United States.”

The settlement also called for mandatory training requirements for Donald Trump Jr., Ivanka Trump and Eric Trump, which all three have completed, James said.

Attorneys for the Trump Foundation accused James of timing her announcement to deflect attention from her office's Tuesday loss against Exxon Mobil in a climate change lawsuit.

“The AG’s office doesn’t want the media to focus on the massive trial they lost today," attorneys Marc Mukasey and Alan Futerfas told Fox News in an emailed statement. "Our case was amicably resolved weeks ago. The judge commended both parties for the resolution. The legacy of the Trump Foundation -- which gave away many millions to those most in need at virtually no cost -- is secure.”

CLICK HERE TO GET THE FOX NEWS APP

The three-decades-old foundation reached a deal with the New York Attorney General to shut down in December 2018 amid the lawsuit. Authorities claimed Trump ran the foundation as an extension of his business empire and presidential campaign.

Last month, Trump said James had deliberately mischaracterized the settlement for political purposes. The foundation's attorney argued that the lawsuit was politically motivated, which a judge rejected.