Over the objections of the FBI, a federal judge on Thursday sided with CNN in an ongoing lawsuit seeking to make public what the bureau said in two secretive court declarations in October 2017, as part of its aggressive efforts to keep memos documenting former FBI director James Comey's meetings with President Trump hidden.

Comey's memos, whose existence was ultimately leaked with Comey's knowledge and which were later obtained by Congress in redacted form, became a catalyst for the appointment of Special Counsel Robert Mueller in May 2017. CNN filed a Freedom of Information Act (FOIA) request that same month, and later filed a lawsuit seeking access to the memos.

In their original complaint, CNN noted that FBI Section Chief David Hardy and FBI Deputy Assistant Director in the Counterintelligence Division David Archey, as well as an attorney in Special Counsel Robert Mueller's office, promptly submitted ex parte declarations to the federal district court in Washington, D.C., as part of their argument that publicly releasing the memos would compromise an ongoing probe.

WHY DID COMEY KEEP TRUMP MEMOS HIDDEN FROM DOJ LEADERSHIP?

Those declarations were sealed. But whatever Hardy, Archey and the special counsel lawyer said, the court indicated that it found their private explanations compelling.

Nevertheless, on April 19, 2018, the FBI turned over redacted versions of the memo to Congress, which then provided them to the media -- raising questions, CNN argued, as to what the FBI had told the court the previous year, and what had suddenly changed.

Former FBI director James Comey speaks during the Canada 2020 Conference in Ottawa on Tuesday, June 5, 2018. (Justin Tang/The Canadian Press via AP)

Washington District Court Judge James E. Boasberg -- an Obama appointee who was also tapped by Chief Justice John Roberts for a seat on the Foreign Intelligence Surveillance Act (FISA) court -- issued an order Wednesday demanding the FBI hand over "clean and redacted copies of the documents in dispute here," apparently including the Comey memos and documents relating to the declarations.

Boasberg will review the materials "in camera," meaning privately, as he determines whether to make public the FBI's secretive declarations. The FBI, in its opposition filing, insisted there was no legal basis to turn over the materials.

But CNN's reply brief argued that the FBI had "failed" to establish a compelling reason to keep the documents secret, noting that there is a strong presumption in favor of access to court records -- and that, by releasing the memos to Congress, the FBI had conceded there was no legitimate law enforcement justification for denying the FOIA request in he first place.

The DOJ's inspector general, meanwhile, is reviewing whether some of the Comey memos improperly contained classified information.

Boasberg's order comes as President Trump, in a fiery interview Wednesday night on Fox News' "Hannity," vowed to "get to the bottom" of how the discredited Russia-Trump collusion narrative began.

Trump promised to "declassify and release" key FBI FISA warrant applications and related documents -- including the entirety of a FISA application to surveil a Trump aide that relied heavily on an unsubstantiated, leaked dossier created by an anti-Trump ex-British spy working for a firm hired by the Hillary Clinton campaign and Democratic National Committee.

The memos, which a personal Comey friend leaked to the media following Comey's termination, were more widely shared within the government than previously known, three sources familiar with the matter told Fox News last year -- although Comey later admitted to hiding the memos from some senior DOJ officials.

Last April, the DOJ gave lawmakers redacted versions of five of the memos, a congressional source told Fox News.

CLICK TO GET THE FOX NEWS APP

The fired FBI director wrote in one of his memos that Trump had told him, "I hope you can let this go," amid reports that former National Security Adviser Michael Flynn had lied to the FBI and senior White House officials about his contacts with Russia's government.

Flynn was ultimately charged only with making false statements to FBI officials concerning the extent of his discussions with the then-Russian ambassador on U.S. sanctions and a United Nations vote on Israel. He was fired by the Trump administration for lying to Vice President Mike Pence regarding the same topics.

Fox News' Bill Mears, Catherine Herridge and Brooke Singman contributed to this report.