For months now, Republican presidential candidate Donald Trump has faced repeated demands to release his tax returns to prove his financial worth, but he has refused. So over the weekend, someone decided to do it for him by sending some of his tax info to a reporter at the New York Times.
After the Times wrote a story suggesting that Trump may have avoided paying taxes for close to two decades as a result of a large tax loss on his real estate investments, the candidate threatened to sue the newspaper. But would Trump have a leg to stand on legally?
The short answer is yes and no. The New York Times would have a fairly compelling First Amendment case to make, but Trump also has some legal weight on his side.
Obviously, newspapers like the Times and the Washington Post publish leaked information from anonymous sources regularly, including the classified information the Post got from CIA whistle-blower Edward Snowden, the diplomatic cables that the Times, and other papers obtained from WikiLeaks.
Even farther back, the Post published the Pentagon Papers—classified documents on the war in Vietnam that were leaked by Daniel Ellsberg—and it also published information it got from an administration source about the Watergate break-ins and the connection to President Richard Nixon.
The core of any argument about stories of this kind is that they are protected by the First Amendment because there is a clear public interest in having the information released that outweighs the fact that it was classified, or may have been obtained by illegal means.
Get Data Sheet, Fortune’s technology newsletter.
But the Republican candidate has a potential ace up his sleeve when it comes to making a case against the New York Times should he decide to do that. That’s because there are both federal and state laws that specifically forbid the publication of tax returns without the permission of the individual in question. Federal law says it is an offense to “willfully print or publish in any manner not provided by law any such return or return information,” and both New York and New Jersey law make it a crime to “divulge or make known in any manner the amount of income or any particulars set forth or disclosed in any report or return.”
One legal analyst also argues that the New York Times left itself wide open to such a case because editor Dean Baquet said in a recent public forum that he knew publishing such information would be illegal, but that he was willing to risk jail time to do it anyway. Saying this could qualify as “willful” disregard of the law, lawyer Robert Barnes wrote for the site LawNewz, and a court would take that into account when assessing the newspaper’s right to do so.
The Times could obviously argue that the public interest outweighs the restrictions imposed by these laws, but not everyone is convinced it would succeed.
Jonathan Zittrain, a professor at Harvard Law School and an expert in the First Amendment, told the Washington Post that a court could decide that if the public interest was so compelling, then newspapers or the public should try to compel the candidate to authorize the IRS to release his tax information lawfully.
Donald Trump finally admits President Obama was born in the United States. Watch:
A number of other legal analysts, however, seem to think that the Times would have a fairly open and shut case on its hands if Trump decides to sue.
Although no recent First Amendment cases could be seen to apply directly to the publication of tax returns from a candidate for president, lawyer Floyd Abrams said that “all the cases make it extremely unlikely that the Times could constitutionally be held liable for publishing such a newsworthy story, a month before a presidential election, about a candidate for President.”
First Amendment expert Robert Corn-Revere went even further, saying “the notion that the Times could be held liable in some fashion for publishing information it lawfully obtained about Donald Trump’s taxes is delusional. There are hard First Amendment cases but this would not be one of them.”
Trump has made it clear that he is not a fan of the media, and has said that if he becomes president he intends to “open up” libel laws to make it easier to sue the press for reporting certain things. Whether he wants to get a head start on that by suing the New York Times remains to be seen.