US President Donald Trump and First Lady Melania Trump (not pictured) return to the White House in Washington, DC, on August 4, 2019.

A federal judge on Monday dismissed President Donald Trump's lawsuit seeking to block the release of his personal and corporate tax returns to the Manhattan district attorney, who is conducting a criminal investigation related to the president's company.

U.S. District Judge Victor Marrero's ruling flatly rejected what he called the "extraordinary claim" by Trump that while president he is immune not only from criminal prosecution but also from being criminally investigated by a state prosecutor or anyone else.

Marrero said that under Trump's theory, not only his behavior would be immune from an investigation, but so would suspected "misconduct of any other person, business affiliate, associate or relative who may have collaborated with the President in committing purportedly unlawful acts."

"This Court finds aspects of such a doctrine repugnant to the nation's governmental structure and constitutional values," Marrero wrote in his 75-page decision in U.S. District Court in Manhattan. Marrero said if Trump's argument was allowed, it could "frustrate the administration of justice" in regard to a president's conduct.

Trump's lawyers immediately appealed the ruling.

Less than two hours later, the U.S. Circuit Court for the Second Circuit granted a temporary stay of enforcement of a grand jury subpoena for eight years of Trump's tax returns from his accoutants, Mazars USA, pending an expedited review a a panel of that court's judges.

Shortly thereafter, the U.S. Justice Department filed an appearance in the case, saying it would make arguments in support of Trump.

Read the court's ruling here.

Trump, in reaction to the ruling, suggested that congressional Democrats are in cahoots with DA Cyrus Vance Jr. to try to bring him down. "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," he tweeted.

Trump tweet

Trump's personal lawyer Jay Sekulow told NBC News, "We are very pleased that the Second Circuit Court of Appeals has issued a stay of the subpoena issued by New York District Attorney Cy Vance."

A spokesman for Vance declined to comment. But Vance's office later Monday asked the appeals court to order the parties to file legal briefs in the case over the next several days and set oral arguments, "if any," for this coming Friday.

Trump's legal team also want a quick hearing in the case, but not as quick as Vance suggested. In a letter to the appeals clerk, a lawyer for Trump asked the court to order briefs to be filed starting Friday, and to be finished by a week later.

The court then "should hear oral arguments as soon as it deems practicable."

Vance's office had objected to a federal court becoming involved in the dispute. Prosecutors also had accused Trump's legal team of trying to delay execution of the subpoena so that the statute of limitations for potential crimes that Vance is investigating would expire.