A key witness in the impeachment investigation filed a lawsuit Friday asking a federal judge to rule on whether he can testify, a move that raises new doubts about whether President Trump’s closest aides, like the former national security adviser, John R. Bolton, will be able to cooperate with the inquiry.

House Democrats had subpoenaed the witness, Charles M. Kupperman, who served as Mr. Trump’s deputy national security adviser, to testify on Monday. But in an effort to stop Mr. Kupperman from doing so, the White House said on Friday that the president had invoked “constitutional immunity,” leaving Mr. Kupperman uncertain about what to do.

“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 suit said.