A former top national security aide to President Trump filed a lawsuit Friday asking a federal judge to resolve conflicting orders from Congress and the White House over whether he must testify in the impeachment inquiry, setting up a potentially momentous legal battle that could determine the course of the investigation.

Charles Kupperman, who served as a deputy to former national security adviser John Bolton, is seeking a judicial ruling on whether he should comply with a subpoena from House Democrats or follow instructions from the White House not to appear.

“Plaintiff obviously cannot satisfy the competing demands of both the Legislative and Executive Branches, and he is aware of no controlling judicial authority definitively establishing which Branch’s command should prevail,” the lawsuit read.

The case could become the major test of what has emerged as a top constitutional dispute of the Trump era: whether the White House can prevent Trump’s top advisers from testifying before Congress, in this case about the president’s efforts to pressure Ukraine into investigating his political rivals.

“If this case is ultimately decided by the Supreme Court, it will be one of the most consequential separation of powers cases in American constitutional history — however it is decided,” former federal judge J. Michael Luttig told The Washington Post.

The outcome could also guide whether Bolton, who has not been subpoenaed, will face House investigators as part of the impeachment inquiry. Bolton and Kupperman, both represented by attorney Charles Cooper, are important witnesses for Democrats on Capitol Hill. Unlike some of the witnesses who have appeared in the inquiry so far, both have long records as Republican advisers — and both had access to private deliberations at the White House involving the president’s communications about Ukraine. Democrats on the House Intelligence and Judiciary committees have expressed keen interest in having both men testify.

House Democrats subpoenaed Kupperman on Friday, ordering him to appear for a previously scheduled Monday morning deposition at the Capitol, according to the lawsuit. Kupperman’s attorney immediately asked the White House for the president’s position on the document.

In a letter, White House counsel Pat Cipollone responded that “constitutional immunity” protected Trump’s current and former senior advisers and that Kupperman was “absolutely immune from compelled congressional testimony with respect to matters related to his service as a senior adviser to the President.” The letter ordered Kupperman not to comply with the subpoena.

The directives have created a Catch-22 for Kupperman, according to the lawsuit: He wants to do his constitutional duty but needs the courts to step in to tell him exactly what that duty is.

“Absent a definitive judgment from the Judicial Branch,” the lawsuit said, “Plaintiff will effectively be forced to adjudicate the constitutional dispute himself, and if he judges wrongly, he will inflict grave constitutional injury on either the House or the President.”

The lawsuit said that the Department of Justice’s Office of Legal Counsel has for nearly 50 years held that the president and his immediate advisers can’t be compelled to testify on matters related to their official duties.

But the filing also cited a 2008 case, related to the George W. Bush administration’s controversial termination of nine U.S. attorneys, in which a federal court ruled that “absolute immunity” had some limits. In that case, the court found that the president’s counsel was not entitled to absolute or qualified immunity in a congressional inquiry because the inquiry did not “involve the sensitive topics of national security or foreign affairs.”

Ambiguity about how those principles apply to the current investigation could cause Kupperman to violate the law inadvertently, should he be left to decide what to do on his own, according to the lawsuit.

“On the one hand, an erroneous judgment to abide by the President’s assertion of testimonial immunity would unlawfully impede the House from carrying out one of its most important core Constitutional responsibilities,” the lawsuit read. “On the other hand, an erroneous judgment to appear and testify in obedience to the House Defendants’ subpoena would unlawfully impair the President in the exercise of his core national security responsibilities.”

Kupperman asked the court to expedite the case “in light of the pending impeachment proceedings.”

The lawsuit names Trump and several top House Democrats, including House Speaker Nancy Pelosi (D-Calif.) and House Intelligence Committee Chairman Adam B. Schiff (D-Calif.), who is leading the inquiry.

The White House didn’t immediately respond to a request for comment late Friday. Neither did Schiff. House Judiciary Committee Chairman Jerrold Nadler (D-N.Y.) declined to comment on the lawsuit.