President Donald Trump lost an appeal to prevent his accounting firm, Mazars LLP, from releasing eight years of his income tax returns to the New York State government, setting the stage for a Supreme Court fight in 2020.

On Monday, the three judges of the New York-based 2nd U.S. Circuit Court of Appeals unanimously threw out Trump's appeal to keep his tax returns secret, and ruled New York City prosecutors can enforce a subpoena for Trump's tax returns against Mazars.

On the other hand, the 2nd Circuit didn't rule as to whether Trump is immune from being charged with a state crime while in office, which was the argument of Trump's lawyers. The court said that even if he is, the immunity won't stop Manhattan District Attorney Cyrus Vance from getting the returns from a third party such as Mazars, or from prosecuting Trump after he steps down as president.

It would "exact a heavy toll on our criminal justice system to prohibit a state from even investigating potential crimes committed by him for potential later prosecution," wrote 2nd Circuit Chief Judge Robert Katzmann in the 3-0 ruling.

Katzmann also said the extent of the president's immunity is irrelevant to the case.

"The subpoena at issue is directed not to the President, but to his accountants; compliance does not require the President to do anything at all," wrote Katzmann.

Vance wants Trump's tax returns as part of a criminal investigation into Trump and his family's real estate business. The extent of Vance's investigation hasn't been disclosed, however.

The defeat at the 2nd Circuit follows a ruling last October 7 by U.S. District Judge Victor Marrero, who threw out a Trump's lawsuit that basically claimed Trump is immune from both investigation and prosecution as a sitting U.S. president.

Marrero called claim of immunity "repugnant to the nation's governmental structure and constitutional values." This adverse ruling prompted Trump's appeal to the 2nd Circuit, which upheld Marrero's judgment.

In arguing before Marrero, one of Trump's lawyers made the horrific claim state authorities are powerless to act against the president even if he shot someone on the street unless he were removed from office first.

All this drama began in August when Vance subpoenaed Trump's personal and corporate tax returns from 2011 to 2018, and other records from Mazars. Trump sued Vance's office in Manhattan federal court to block the subpoena. His lawyers argue that as a sitting president, Trump cannot be subject to criminal investigation.

Trump's case might not make headway in the Supreme Court either, claims former judge Andrew Napolitano, who is now a legal analyst for Fox News.

Napolitano said Trump's request for a stay by the Supreme Court will put the process on hold until the justices decide whether to hear the case. He said this decision lies with Justice Ruth Bader Ginsburg, a staunch Democrat and Trump critic, who is tasked with ruling on requests such as these from New York State.

Napolitano said Ginsburg will decide whether to allow Vance's subpoena against Mazars USA to go forward while the Supreme Court makes its decision to hear the president's case. He said the 2nd Circuit Court ruled presidential privileges don't apply because the subpoena seeks documents from before Trump entered office.

The fact the documents wouldn't come from Trump but from his accountants won't interfere with White House business.

"[It's] a perfectly rational opinion," according to Napolitano.