The New York attorney general filed a lawsuit against President Donald Trump and the Donald J. Trump Foundation on Thursday, alleging that Trump violated both federal and state law in the mismanagement of his charitable organization.

The New York attorney general’s petition is essentially a civil — not a criminal — complaint. Most defendants would prefer being sued than being prosecuted. But for the presidency, a civil action potentially can do more damage than an indictment.

That’s because — while it remains an open question whether a president is immune from indictment, arrest, or prosecution while in office — there is less debate about presidential immunity from civil suit. The 1997 Supreme Court case of Clinton v. Jones affirmed broad, absolute presidential immunity, but limited that immunity to acts “taken in an official capacity” — holding that a president’s conduct before he became president was not an official act entitled to that absolute immunity.

Even if a charitable foundation gives out more money than it takes in, it can still violate the law if the organization is not run properly.

Therefore, the president is likely less immune to a state attorney general’s petition that is civil in nature than he would be if that same attorney general tried to prosecute him.

If forced to defend against this petition, the president will have to come up with answers for some very serious allegations about his charitable organization, the Trump Foundation.

The petition alleges the foundation was “little more than a checkbook” for payments to not-for-profits. Trump allegedly used charitable assets to pay off the legal obligations of other entities he controlled, to promote Trump hotels (which are obviously not charitable organizations), to purchase personal items, and to support his presidential election campaign. The petition charges a number of specific instances, such as misusing foundation funds to settle legal disputes for his golf club, and to purchase a $10,000 portrait of himself.

Trump has already responded to the New York attorney general’s petition on Twitter:

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 and gave out to charity more money than it took in, $19,200,000. I won’t settle this case!... — Donald J. Trump (@realDonaldTrump) June 14, 2018

If this is the president’s legal defense, it will fail. It’s a position that fundamentally misunderstands the laws governing charities.

Even if a charitable foundation gives out more money than it takes in, it can still violate the law if the organization is not run properly. This is especially so if the money given out doesn’t go to what the law considers an actional charity.

Charities get tax and other benefits, which can be easily abused for personal gain, even when the charity runs at a net loss.

The other reason the president should be concerned is that many of these allegations could be established by the Trump Foundation’s own bookkeeping — or lack thereof. Some of Trump’s other legal battles depend on the testimony and credibility of potential witnesses. The New York attorney general’s petition follows the money — not the stories.

It’s likely Trump and the other defendants will have to answer this petition, one way or another. If forced to engage in discovery or answer questions under oath, they will possibly lock themselves into a story which either flatly denies, or offers a benign explanation for, the attorney general’s allegations.

Finally, the biggest threat posed by the petition is external. The New York attorney general has referred the case over to federal agencies, including the Federal Election Commission and Internal Revenue Service. Should they investigate the Trump Foundation for violations of federal election and tax laws, then this petition could quickly mushroom into yet another federal investigation of the president and those close to him.

Danny Cevallos is an MSNBC legal analyst. Follow @CevallosLaw on Twitter.