President Trump has paid $2 million to eight charities as part of a settlement in which the president admitted he misused funds raised by the Donald J. Trump Foundation to promote his presidential bid and pay off business debts, the New York State attorney general said on Tuesday.

The foundation’s giving patterns and management came under scrutiny during Mr. Trump’s run for office, and last year the New York attorney general filed a lawsuit accusing the president and his family of using the foundation as an extension of their businesses and the campaign.

The payments were part of a settlement announced last month that capped a drawn-out legal battle. In the end, the president admitted in court documents that he had used the foundation to settle legal obligations of his businesses and even to purchase a portrait of himself.

“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,” the attorney general, Letitia James, said in a statement. “Funds have finally gone where they deserve — to eight credible charities.”