WASHINGTON (Reuters) - U.S. President Donald Trump potentially exposed himself to “serious national security and counter-intelligence risks” when he pressed his Ukrainian counterpart to investigate a leading political rival, Democratic presidential hopeful Joe Biden, and his son, the intelligence community’s inspector general warned.

The previously undisclosed warning, included in a Justice Department legal opinion released on Wednesday, reflected the concerns of a whistleblower who filed a complaint about a July 25 call between Trump and then newly elected Ukrainian President Volodymyr Zelenskiy.

The legal opinion does not spell out the counter-intelligence risks, but former U.S. officials have expressed fears to Reuters that Russian spies could have obtained detailed knowledge of the call before it was made public and used it to gain leverage over the U.S. president.

U.S. intelligence agencies accused Russia of interfering in the 2016 U.S. elections to favor Trump, a charge Moscow has denied.

The legal opinion also provided some more detail on the whistleblower, who has not been identified. It said the person had heard from White House officials that Trump had made statements on the call that the whistleblower viewed “as seeking to pressure (Zelenskiy) to take an official action to help the president’s 2020 re-election campaign.”

In a summary of the call released by the White House on Wednesday, Trump pressed Zelinskiy to investigate unsubstantiated allegations that Biden, as vice president, pressured the government to fire a prosecutor who was probing a Ukrainian gas company, on whose board Biden’s son Hunter served.

The intelligence community’s inspector general, Michael Atkinson, was concerned that Trump’s request violated U.S. campaign laws that prohibit any kind of foreign support to an election candidate, the Justice Department opinion said.

Atkinson, who was appointed by Trump, was also worried that “the alleged misconduct by a senior U.S. official to seek foreign assistance to interfere in or influence a federal election could potentially expose the official to serious national security and counter-intelligence risks,” said the opinion.

Atkinson said that while there were indications of political bias on the part of the whistleblower, he concluded that the allegations appeared credible, the opinion said.

The opinion was written by the Justice Department’s Office of Legal Counsel in support of acting Director of National Intelligence Joseph Maguire’s refusal to send the whistleblower complaint to the U.S. Congress. Maguire argued that he did not have jurisdiction over the subject of the complaint.