Donald Trump suffered a major setback in the long struggle to conceal his tax returns on Monday, when he lost a federal court ruling in New York.

A judge ruled that the president’s claim to immunity while in office was “repugnant” and said Manhattan’s district attorney could subpoena eight years of Trump’s personal and corporate tax returns from his accountants, Mazars USA.

An appeals court blocked any immediate handover of the records but the escalating court battle leaves Trump with less room for manoeuvre and adds to woes that include a fast-moving impeachment inquiry, which on Monday saw House Democrats issue subpoenas for documents from the Pentagon and the White House budget office.

Trump is the first US president in nearly 40 years not to release his tax information, despite having promised to do so during the 2016 campaign.

Last month the office of the Manhattan district attorney, Cyrus Vance, investigating hush money payments to women including the pornographic actor Stormy Daniels during the 2016 presidential election, subpoenaed eight years of Trump’s tax returns.

A federal investigation into the hush money led to Trump’s former lawyer and fixer Michael Cohen pleading guilty to campaign finance violations. Trump, who denies Daniels’ claim of a sexual relationship, has claimed any payments were a personal matter, not a campaign expense.

The court cannot square a vision of presidential immunity that would place the president above the law Judge Victor Marrero

The federal investigation wound up in July. Vance, a Democrat, launched a fresh investigation into whether the Trump Organization falsely listed its reimbursement of Cohen for the $130,000 (then £93,000) payment to Daniels as a legal expense. That would be illegal in New York.

Trump’s lawyers argue the president is immune from such an investigation while in office and the US constitution requires Vance to wait until after Trump has left the White House.

On Monday, the US district judge Victor Marrero in Manhattan described the immunity argument as “extraordinary” and as “an overreach of executive power [that was] repugnant to the nation’s governmental structure and constitutional values”.

In a 75-page decision, the judge added: “The court cannot square a vision of presidential immunity that would place the president above the law.”

Despite the impeachment inquiry and a fresh political crisis over Syria, Trump still found time to address the decision on Twitter.

“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 wrote. “A thing like this has never happened to any President before. Not even close!”

The president’s lawyers immediately appealed to the second US circuit court of appeals, which granted a temporary stay of the ruling “pending expedited review”.

Separately, Trump is trying to block Deutsche Bank from handing over financial records, which the bank has said include tax returns and which are sought by multiple House committees.

The criminal investigation in New York is unfolding with Trump already under siege from an impeachment inquiry touched off by his efforts to get Ukraine’s leader to investigate the former vice-president Joe Biden, a potential opponent at the polls next year.

Trump has accused the House speaker, Nancy Pelosi, of handing out subpoenas “like cookies”. There was no let up on Monday as Democrats subpoenaed the heads of the Department of Defense and the Office of Management and Budget for documents related to the Trump administration’s decision to freeze aid to Ukraine.

Democrats said in a statement: “The enclosed subpoena demands documents that are necessary for the committees to examine this sequence of these events and the reasons behind the White House’s decision to withhold critical military assistance to Ukraine that was appropriated by Congress to counter Russian aggression.”

The deadline to comply is 15 October.

Trump has continued to unleash a volley of impetuous tweets, suggesting Pelosi could be guilty of treason.

“Nancy Pelosi knew of all of the many Shifty Adam Schiff lies and massive frauds perpetrated upon Congress and the American people,” Trump wrote on Sunday evening, referring to the chairman of the House intelligence committee, whom he has accused of treason.

Congress is in recess but the House intelligence, foreign affairs and oversight committees will continue to hear from witnesses this week. Gordon Sondland, the US ambassador to the European Union, will give his deposition on Tuesday. Marie Yovanovitch, the former US ambassador to Ukraine who was recalled early, is due to appear on Friday.

A lawyer representing the original intelligence community whistleblower whose complaint launched the impeachment inquiry said on Sunday that a second whistleblower had come forward and spoken to the intelligence community’s internal watchdog, further complicating the president’s case.