President Donald Trump accused the New York Attorney General of “politically motivated harassment” on Thursday after his charitable foundation was ordered to pay $2 million over alleged misuse of funds.

A New York judge ruled that Trump improperly used the Donald J. Trump Foundation for political purposes and did not properly “administer Foundation assets” and made “wrongful related party transactions.” Trump was ordered to pay $2 million to various charities as part of the case’s settlement. (RELATED: NY Judge Orders Trump To Pay $2 Million For Misusing Charity)

Trump admitted in the settlement that he had misused his charity, including by allowing campaign staff to coordinate with the foundation in order to hold a fundraiser for veterans prior to the 2016 election.

The president, however, in a statement released Thursday night, claimed that New York Attorney General Letitia James was mischaracterizing the details of the case for “political purposes.”

STATEMENT FROM PRESIDENT DONALD J. TRUMP pic.twitter.com/EktztHfLk6 — Donald J. Trump (@realDonaldTrump) November 8, 2019

“The court rejected the Attorney General’s frivolous request for statutory penalties, interest and other damages,” Trump wrote in the statement, which he posted on his Twitter account. “It has been 4 years of politically motivated harassment – first by lightweight AG Schneiderman, prior to his resignation for beating up women – then AG Underwood, who was impossible to deal with, and now Letitia James.”

He added that James “refuses to investigate the Clinton Foundation with all of its problems” and that the prosecution was only able to find “small technical violations” with his own charity.

“I am the only person I know, perhaps the only person in history, who can give major money to charity ($19M) charge no expense, and be attacked by the political hacks in New York State. No wonder why we are all leaving,” Trump said, referencing his own decision to move his primary residence to Florida from New York.

New York Attorney General Barbara Underwood first sued the Trump family over alleged misuse of charitable funds in June 2018. The foundation was later dissolved in December 2018, with its remaining assets being distributed to various charities.