New York — A federal judge has emphatically rejected President Trump's challenge to the release of his tax returns to New York prosecutors, saying Monday that the president's broad claim of immunity from all criminal investigations is at odds with the Constitution. But an appeals court blocked any handover of the records for now.

At issue is a request from Manhattan District Attorney Cyrus R. Vance Jr. that Mr. Trump's accounting firm turn over eight years' worth of his business and personal tax returns for an investigation into the payment of hush money to two women who claimed to have had affairs with the president.

U.S. District Judge Victor Marrero turned down Mr. Trump's attempt to keep the tax returns under wraps, saying the president was making a "categorical and limitless assertion of presidential immunity."

The president's lawyers immediately appealed to the 2nd U.S. Circuit Court of Appeals, and it granted a temporary stay of the judge's ruling "pending expedited review" by the court.

Get Breaking News Delivered to Your Inbox

"The Radical Left Democrats have failed on all fronts," Mr. Trump fumed on Twitter, "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!"

The criminal investigation in New York is unfolding with Mr. Trump already under siege on Capitol Hill from a fast-moving impeachment drive set off by his attempts to get Ukraine's leader to investigate his political rival Joe Biden. The judge's ruling marked the latest in a string of setbacks for the president in the past couple of weeks.

Mr. Trump's lawyers have said that the investigation led by Vance, a Democrat, is politically motivated and that the request for his tax records should be stopped because he is immune from any criminal probe as long as he is president.

Marrero called Mr. Trump's claim of broad immunity "extraordinary" and "an overreach of executive power."

"As the court reads it, presidential immunity would stretch to cover every phase of criminal proceedings, including investigations, grand jury proceedings and subpoenas, indictment, prosecution, arrest, trial, conviction, and incarceration," the judge wrote. "That constitutional protection presumably would encompass any conduct, at any time, in any forum, whether federal or state, and whether the President acted alone or in concert with other individuals."

The judge said couldn't accept that legal view, "especially in the light of the fundamental concerns over excessive arrogation of power" that led the founding fathers to create a balance of power among the three branches of government.

Mr. Trump's lawyers and the district attorney's office did not immediately comment in response to the ruling. Justice Department attorneys in Washington, who had urged Marrero to delay deciding the issue, declined to comment.

Vance began his probe after federal prosecutors in New York completed their investigation into payments that Mr. Trump's former personal lawyer, Michael Cohen, arranged to be paid to porn star Stormy Daniels and Playboy model Karen McDougal to keep them silent during the presidential race. The Trump Organization later reimbursed Cohen.

Cohen is serving a three-year prison sentence for crimes that included campaign finance violations in connection with the hush money.

Mr. Trump was never charged, though prosecutors said publicly that he was aware of and directed the illegal payments. Justice Department policy has long been that sitting presidents cannot be charged criminally.

The president has steadfastly refused to make his tax returns public, breaking from a tradition set by presidents and presidential candidates decades ago.

Grand jury proceedings and records in New York are secret. If Vance gains access to Mr. Trump's returns through a grand jury investigation, that doesn't mean that their contents will be disclosed publicly.

It is unclear what Mr. Trump's returns might have to do with the criminal investigation.