(CNN) - A federal judge on Monday dismissed President Donald Trump's effort to prevent his tax returns from being turned over to a New York grand jury.
The ruling raises the likelihood that Trump's tax returns will be provided in response to a subpoena from the Manhattan district attorney's office, although any material obtained through a grand jury subpoena is covered by grand jury secrecy rules, meaning it would likely become public only if it were used as evidence at a trial.
Dismissing Trump's "extraordinary" claim that any occupant of the White House enjoys "absolute immunity from criminal process of any kind," US District Judge Victor Marrero said in a 75-page opinion that such a position "would constitute an overreach of executive power."
The judge described Trump's assertion of immunity as "repugnant to the nation's governmental structure and constitutional values."
An attorney for Trump filed an emergency notice of appeal to the 2nd US Circuit Court of Appeals minutes after the district judge filed his decision, and the appeals court immediately ordered a temporary stay of the subpoena.
In a tweet Monday, Trump criticized the legal effort.
"The Radical Left Democrats have failed on all fronts, so now they are pushing local New York City and State Democrat prosecutors to go get President Trump. A thing like this has never happened to any President before. Not even close!" Trump tweeted.
Trump attorney Jay Sekulow said his legal team was "very pleased" by the temporary stay issued by the appeals court.
The skirmish over the subpoena stems from an investigation by the district attorney's office, which is examining the circumstances surrounding hush money paid during the 2016 presidential campaign to two women who alleged having affairs with Trump a decade ago. Trump has denied the affairs.
The investigation concerns whether the Trump Organization violated any New York state laws -- including potentially filing false business records -- in its effort to reimburse Michael Cohen, Trump's former attorney, who paid some of the hush money on Trump's behalf. Cohen is serving a prison sentence after pleading guilty in a federal case concerning the payments.
As part of its probe, the DA's office sent Trump's accounting firm, Mazars USA, a grand jury subpoena seeking tax returns and related documents going back to 2011, and Trump subsequently sued to try to block it.
On Monday, following the ruling, a spokeswoman for the company said, "Mazars USA will respect the legal process and fully comply with its legal obligations."
A spokesman for the district attorney's office declined to comment.
Conflict with Justice Department memo
In his opinion, Marrero allowed that some aspects of the criminal process could impede a President's ability to perform his duties. "Certainly lengthy imprisonment upon conviction would produce that result," he wrote.
But, Marrero added, "that consequence would not necessarily follow every stage of every criminal proceeding," and in particular, he said, doesn't extend to a president's compliance with a grand jury subpoena for records the president controls.
The judge wrote that the issues at hand stretched back to questions addressed by the Founding Fathers.
"Shunning the concept of the inviolability of the person of the King of England and the bounds of the monarch's protective screen covering the Crown's actions from legal scrutiny, the Founders disclaimed any notion that the Constitution generally conferred similarly all-encompassing immunity upon the President," Marrero wrote.
Courts have ruled that a president can be subjected to a civil suit concerning conduct that took place before he took office and must comply with subpoenas regarding third parties, Marrero pointed out. "The notion of federal supremacy and presidential immunity from judicial process that the President here invokes, unqualified and boundless in its reach as described above, cuts across the grain of these constitutional precedents," he wrote.
Marrero also rejected other arguments made by Trump's counsel, including that the lawsuit should be considered in federal court, rather than state. "The President provides no compelling proof that New York courts could fail to adequately adjudicate his immunity claim, relying instead on the unsubstantiated allegation that he would risk 'local prejudice,' " the opinion states.
"[T]he President's prophecies that he will be indicted and denied due process in state proceedings are, at best, speculative and unripe," he wrote.
And in a 30-page section of the opinion that could have implications beyond Trump's lawsuit, Marrero repudiated the conclusions of a set of Justice Department memos that held the President can't be indicted or criminally prosecuted, documents that prosecutors including special counsel Robert Mueller have said prevented them from pursuing cases against the President.
"[T]he Court rejects the DOJ Memos' position," Marrero wrote. "It concludes that better-calibrated alternatives to absolute presidential immunity exist yielding a more appropriate balance between, on the one hand, the burdens that subjecting the President to criminal proceedings would impose on his ability to perform constitutional duties, and, on the other, the need to promote the courts' legitimate interests and functions in ensuring effective law enforcement attendant to the proper and fair administration of justice."
He cautioned that preventing the pursuit of criminal justice in the face of an assertion of immunity "should be an absolutely last resort."
"It should be justified by exacting reasons of momentous public interest such as national security, and be reviewable by a court of law," Marrero wrote. "Above all, its effective should be not to shield the President from all legal process, especially in circumstances where it may appear that a claim of generalized immunity is invoked more on personal than on official grounds, and work to place the President above the law."
The ruling is also a setback for the US Justice Department, which had asked last week to temporarily block the subpoena, to allow time for "appropriate briefing of the weighty constitutional issues involved."
"The President's complaint raises a number of significant constitutional issues that potentially implicate important interests of the United States," Justice Department officials wrote in a court filing.
On Monday, Justice Department attorneys said they would participate in Trump's appeal, saying they would serve as amicus counsel in support of him.
This story has been updated.