President-elect Donald Trump talks to reporters after meeting with military leadership at his Mar-a-Lago club in Palm Beach, Fla., this month. (Jabin Botsford/The Washington Post)

President-elect Donald Trump took to Twitter on Monday night to defend the charitable foundation he has pledged to close, saying the media had not given him enough credit for his generosity and ignoring the legal issues that have ensnared the organization in controversy.

The Donald J. Trump Foundation has come under intense scrutiny this year after reports in The Washington Post detailing its practices, including cases in which Trump apparently used the charity’s money to settle lawsuits involving his for-profit businesses.

New York’s attorney general is investigating the charity, and a spokeswoman for that office said Saturday that the foundation could not officially shut down until that probe is over. Among the issues at hand is whether Trump violated a “self-dealing” provision that says nonprofit leaders cannot use their charities’ funds to help themselves, their relatives or their businesses.

“I gave millions of dollars to DJT Foundation, raised or recieved millions more, ALL of which is given to charity, and media won’t report!” Trump said in one Monday night tweet.

(Victoria Walker,Peter Stevenson/The Washington Post)

“The DJT Foundation, unlike most foundations, never paid fees, rent, salaries or any expenses. 100% of money goes to wonderful charities!” the president-elect said in another.

Trump and his companies gave about $6 million to his foundation since its launch in 1987, according to tax filings. The most recent tax filings go up to the end of 2015.

Other people have collectively given about $9.5 million. The biggest outside donors were Vince and Linda McMahon, two pro-wrestling moguls, who gave the Trump Foundation $5 million between 2007 and 2009. Trump recently nominated Linda McMahon to head the Small Business Administration.

Trump himself gave nothing to his foundation between 2009 and 2014, according to filings. His businesses contributed in 2015 for the first time in several years.

Experts on charities say it’s rare for the founder of a private, name-branded foundation to give nothing to his own foundation while relying entirely on donations from others. That anomaly allowed Trump to take advantage of the idea that the money in the foundation was his.

Trump’s donations to his foundation are also small, by the standards of billionaires’ philanthropy.

Filmmaker George Lucas, for instance, who is tied with Trump at 324th place on Forbes’s list of the world’s billionaires, donated $925 million to his family foundation in 2012. In 2014, Lucas’s foundation gave $55 million in donations to museums, hospitals, artistic groups and environmental charities.

While much of the Trump foundation’s money has gone to charity, there are some high-profile exceptions.

In 2013, the Trump foundation gave a $25,000 gift to a campaign committee backing Florida Attorney General Pam Bondi (R), even though nonprofits like the charity are not allowed to give political gifts.

That gift was made as Bondi’s office was considering whether to investigate fraud allegations against Trump University. A consultant who worked on Bondi’s reelection effort has said that Bondi was not aware of the allegations when she solicited the donation from Trump. Ultimately, Bondi’s office did not pursue the fraud allegations.

Trump also reported using foundation money to buy items for himself, which runs afoul of federal tax law.

The Trump Foundation spent $30,000 to buy two large portraits of Trump, including one that was hung up in the sports bar at a Trump-owned resort. Trump also appears to have used $258,000 of his foundation’s money — legally earmarked for charitable purposes — to settle lawsuits involving two of his for-profit clubs.

The office of New York Attorney General Eric Schneiderman (D) announced its investigation of the Trump Foundation after reports in The Post described such apparent cases of self-dealing that date back to 2007.

Trump’s foundation has admitted in IRS tax filings for 2015 that it violated a prohibition against self-dealing that says nonprofit leaders cannot use their charities’ funds to help themselves, their relatives or their businesses.

In these tax filings, the charity checked “yes” in response to a question asking whether it had transferred any income or assets to “a disqualified person” — a description that could have meant Trump, a relative or a Trump-owned business.

Trump has not said what exactly he did to violate the rule or what he has paid the IRS in penalty taxes as a result. The IRS has not commented when asked whether it was investigating the Trump Foundation.

The New York attorney general’s investigation is unlikely to lead to any kind of criminal charge. Instead, Trump may be required to repay his foundation the money it spent to help him, and he may have to personally pay penalty taxes worth 10 percent or more of the value of the self-dealing transactions.

Trump’s tweet was correct in that his foundation has low overhead. It has no paid staff and only a five-member board. It also has spent almost nothing on legal fees, raising the question of whether the organization was aware of the legal problems it created.