A federal judge on Monday dismissed a lawsuit by former national security adviser John Bolton's onetime deputy that sought to answer whether the White House could block him from testifying before Congress.

Charles Kupperman, who was deputy national security adviser from January to September, filed the suit in U.S. District Court in Washington after he was subpoenaed to testify in the House impeachment inquiry in late October. The White House ordered Kupperman not to cooperate, and he wanted direction from the court on which of the co-equal branches of government he should listen to.

He didn't get his answer. In a ruling Monday, Judge Richard Leon agreed with attorneys for the House of Representatives that the question was moot because the House withdrew its subpoena in November. House attorneys had also assured the judge that they wouldn't hold Kupperman in contempt or refer him for prosecution.

Attorneys for the House backed away from the fight because they were concerned that the issue would get tied up in a long court battle, an Intelligence Committee official told NBC News at the time.

Had the House lost the case, it could have further hampered efforts to get Trump administration witnesses to testify. The White House had directed administration officials not to cooperate with the House investigation.

Had the court sided with the House, however, it could have had major benefits for the impeachment inquiry. Bolton, a central figure in the inquiry who pushed back against President Donald Trump's freeze on aid to Ukraine, had said he would be bound by whatever the courts decided in Kupperman's case.

Download the NBC News app for breaking news and politics

He and Kupperman were both represented by Charles Cooper, who told attorneys for the House that Bolton "was personally involved in many of the events, meetings, and conversations about which you have already received testimony, as well as many relevant meetings and conversations that have not yet been discussed in the testimonies thus far."

Acting White House chief of staff Mick Mulvaney tried to join Kupperman's suit but changed his mind after attorneys for Kupperman and the House Intelligence Committee, which led the inquiry, urged the judge not to let that happen.

In his ruling, Leon noted that the issue might arise again.

"Have no doubt though, should the winds of political fortune shift and the House were to reissue a subpoena to Dr. Kupperman, he will face the same conflicting directives that precipitated this suit," the judge wrote. "If so, he will undoubtedly be right back before this court seeking a solution to a constitutional dilemma that has longstanding political consequences: balancing Congress's well-established power to investigate with a president's need to have a small group of national security advisors who have some form of immunity from compelled congressional testimony."