Donald Trump has blocked the former White House counsel Don McGahn from testifying before Congress about the special counsel report on Russian election interference, prompting sharp criticism and even threats of impeachment.

In a legal opinion released on Monday, the justice department said lawmakers on Capitol Hill cannot compel McGahn, who was subpoenaed by the House judiciary committee, to answer their questions under oath.

“The Department of Justice has provided a legal opinion stating that, based on long-standing, bipartisan, and constitutional precedent, the former counsel to the president cannot be forced to give such testimony, and Mr McGahn has been directed to act accordingly,” the White House press secretary, Sarah Sanders, said in a statement.

“This action has been taken in order to ensure that future presidents can effectively execute the responsibilities of the office of the presidency.”

McGahn is a central figure in special counsel Robert Mueller’s report, often standing in the way of Trump’s efforts to obstruct justice. According to investigators, McGahn threatened to resign when the president ordered him to have Mueller fired.

McGahn was also dispatched by Trump to convince the former attorney general Jeff Sessions not to recuse himself from overseeing the Russia investigation. (Sessions did not heed the president’s demands.)

Travelling to a rally in Pennsylvania, Trump was asked why he was asking McGahn to defy a congressional subpoena. “Well, as I understand it, they’re doing that for the office of the presidency, for future presidents,” he replied, according to a pool report. “I think it’s a very important precedent. And the attorneys say that they’re not doing that for me. They’re doing it for the office of the president. So we’re talking about the future.”

The White House’s intervention was condemned by Jerry Nadler, the Democratic chairman of the judiciary committee. “The Mueller report documents a shocking pattern of obstruction of justice,” he said in a statement. “The president acted again and again – perhaps criminally – to protect himself from federal law enforcement.

“Don McGahn personally witnessed the most egregious of these acts. President Trump knows this. He clearly does not want the American people to hear firsthand about his alleged misconduct, and so he has attempted to block Mr McGahn from speaking in public tomorrow.”

The move is the latest example of the Trump administration’s “disdain for the law”, added Nadler, who said the committee will meet as planned on Tuesday morning and still expects McGahn to appear.

Another Democratic member of the committee, David Cicilline, went further in his criticism, suggesting that impeachment of Trump would be warranted if McGahn did not respond to the subpoena.

“Let me be clear: if Don McGahn doesn’t testify, it is time to open an impeachment inquiry,” he told the MSNBC network. “The president has engaged in an ongoing effort to impede our ability find the truth, to collect evidence, to do our work … No one is above the law, including the president of the United States.”

Cicilline admitted he did not know if his view was shared by other members of Democratic leadership but added: “We may well be forced into a position to have to open a formal inquiry in order to facilitate the collection of the evidence that we need to see.”

The justice department’s legal opinion does not prevent McGahn testifying if he so chooses, although it would be potentially at risk to his own career. Trump has mused about instructing Republicans to cease dealing with his law firm, Jones Day, the Associated Press reported.

Matthew Miller, former director of the office of public affairs for the justice department, tweeted: “Just show up and testify, McGahn. This isn’t about some garden-variety Congressional-executive branch dispute, but as one of your predecessors described it, a cancer on the presidency. Think about your place in history.”

McGahn was subpoenaed by Nadler last month and, under instruction by the White House, failed to meet an initial deadline to appear before the committee. Nadler threatened to hold McGahn in contempt of Congress if he did not meet a second deadline of 21 May.

McGahn, who left the White House last year, has increasingly become the subject of Trump’s ire following the release of the redacted Mueller report. Last week, the president tweeted he was “never a big fan” of McGahn and suggested it was the former White House counsel, and not Mueller, who was on his chopping block at the time of the investigation.

The Trump administration has repeatedly blocked attempts at oversight by the Democratic-controlled House. Last month it instructed the former personnel security director Carl Kline not to testify at a hearing into alleged lapses in White House security clearance procedures. Last week the treasury secretary, Steven Mnuchin, refused to comply with a congressional subpoena to hand over Trump’s tax returns.

Nadler’s committee has previously voted to hold the attorney general, William Barr, in contempt for refusing to provide the unredacted Mueller report and underlying evidence to Congress.