NEW YORK (Reuters) - President Donald Trump’s longtime accounting firm must hand over eight years of his tax returns to New York prosecutors, a U.S. appeals court ruled Monday, the latest setback for Trump in his tenacious efforts to keep his finances secret.

The ruling by a unanimous three-judge panel of the New York-based 2nd U.S. Circuit Court of Appeals backed the ability of prosecutors to enforce a subpoena for the returns against accounting firm Mazars LLP. Jay Sekulow, a lawyer for Trump, said the Republican president will appeal the ruling to the U.S. Supreme Court, whose 5-4 conservative majority includes two justices appointed by Trump.

The office of Manhattan District Attorney Cyrus Vance, a Democrat, is seeking the returns as part of a criminal investigation into Trump and his family real estate business. The scope of that probe is not publicly known.

The 2nd Circuit did not decide whether Trump is immune from being charged with a state crime while in office, as the president has argued. However, it found that even if he is, the immunity could not stop Vance from getting the returns from a third party, or from prosecuting him once he leaves office.

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,” 2nd Circuit Chief Judge Robert Katzmann wrote in the ruling.

Vance’s office has agreed not to enforce the subpoena while Trump petitions the Supreme Court. Under the agreement, Trump has 10 calendar days to file the petition.

The timing of Monday’s decision means the Supreme Court could probably take up and decide the case in its current term, which ends in June. It could, however, wait until its next term to hear the case, potentially pushing its decision until after Trump goes up for reelection next year.

The Supreme Court could also decline to hear the case altogether, which would effectively uphold the 2nd Circuit’s decision and clear the way for Vance to get Trump’s tax returns.

A spokesman for Vance declined to comment on the ruling.

FILE PHOTO: U.S. President Donald Trump waves to the media as he walks on the South Lawn of the White House in Washington upon his return from New York, U.S., November 3, 2019. REUTERS/Yuri Gripas/File Photo

Trump, who built a real estate empire with his New York-based business before becoming president, separately faces an impeachment inquiry in the Democratic-led U.S. House of Representatives.

BREAKING TRADITION

Trump has refused to make his tax returns public, breaking with a decades-old tradition of U.S. presidential candidates releasing their returns during campaigns and presidents disclosing them while in office.

In August, Vance subpoenaed Trump’s personal and corporate tax returns from 2011 to 2018, and other records from Mazars USA, the president’s longtime accounting firm. Trump sued Vance’s office in Manhattan federal court to try to block the subpoena, arguing that as a sitting president, he cannot be subject to criminal investigation.

On Oct. 7, U.S. District Judge Victor Marrero threw out Trump’s lawsuit, calling his claim of immunity “repugnant to the nation’s governmental structure and constitutional values.” The ruling prompted Trump’s appeal to the 2nd Circuit.

Arguing before the appeals court on Oct. 23, a lawyer for Trump made the claim of immunity more explicit, saying state authorities would be powerless to act against the president even if he shot someone on the street unless he were removed from office first.

Katzmann wrote in Monday’s order that the extent of the president’s immunity was 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,” Katzmann wrote.

Katzmann was appointed to the court by former President Bill Clinton, a Democrat. The other two judges on the panel, Christopher Droney and Denny Chin, were both appointed by former President Barack Obama, Trump’s predecessor and also a Democrat.

More broadly, Trump has also fought efforts by Democrats in Congress and others to obtain information about his finances and a range of other matters.

Treasury Secretary Steven Mnuchin in May refused to release Trump’s tax returns to a House committee, saying the request was not based on “a legitimate legislative purpose.” The House then sued the Treasury Department and the Internal Revenue Service in July to try to get access to the tax records.

The U.S. Court of Appeals for the District of Columbia Circuit on Oct. 11 ruled in favor of a separate House bid to obtain Trump’s financial records from Mazars, a decision that has been stayed pending appeal.

The House impeachment inquiry focuses on the president’s request in a July phone call for Ukrainian President Volodymyr Zelenskiy to investigate a domestic political rival, Joe Biden, the former vice president and a top contender for the 2020 Democratic presidential nomination to face Trump.