– Soon after he took over as CIA director, Mike Pompeo privately told lawmakers about a new target for U.S. spies: Julian Assange, the founder of WikiLeaks.

Intent on finding out more about Assange’s dealings with Russian intelligence, the CIA last year began to conduct traditional espionage against the organization, according to U.S. officials. At the same time, federal law enforcement officials were reconsidering Assange’s designation as a journalist and debating whether to charge him with a crime.

Pompeo and former Attorney General Jeff Sessions unleashed an aggressive campaign against Assange, reversing an Obama-era view of WikiLeaks as a journalistic entity. For more than a year, the nation’s spies and investigators sought to learn about Assange and his ties to Russia as senior administration officials came to believe he was in league with Moscow.

Their work culminated in prosecutors’ secretly filing charges this summer against Assange, which were inadvertently revealed in an unrelated court document and confirmed Friday by a person familiar with the inquiry. Taken together, the CIA spying and the Justice Department’s targeting of Assange represented a remarkable shift by both the government and President Donald Trump, who repeatedly lauded WikiLeaks during the 2016 campaign for its releases of Democratic e-mails, stolen by Russian agents, that damaged his opponent, Hillary Clinton.

A prosecution of Assange could pit the interests of the administration against Trump’s. Assange could help answer the central question of the investigation by special counsel Robert Mueller: whether any Trump associates conspired with Russia to interfere in the presidential race. If the case against Assange includes charges that he acted as an agent of a foreign power, anyone who knowingly cooperated with him could be investigated as a co-conspirator, former senior law enforcement officials said.

Justice Department officials on Friday did not disclose the charges against Assange, prompting speculation around Washington about their nature. The case might be tied to the hacked Democratic e-mails, which are part of Mueller’s evidence of the wide-ranging election interference personally ordered by President Vladimir Putin of Russia. The charges could also be related to WikiLeaks’ publication last year of CIA tools to penetrate computers and mobile devices, the Vault 7 disclosures.

National security officials have long viewed Assange with hostility and considered him a threat. “He was a loathed figure inside the government,” said Andrea Kendall-Taylor, who served as a deputy national intelligence officer for Russia under the director of national intelligence until May.

Assange seemed to have crossed into uncharted ground by 2016 with the publication of e-mails stolen from the Democratic National Committee’s servers and Clinton’s campaign chairman, former FBI officials said. He was deliberately attacking Clinton over Trump and coordinating with Russian intelligence operatives, wittingly or not, to maximize the damage to her campaign.

Law enforcement officials had been trying to learn more about Assange’s knowledge of WikiLeaks’ interactions with Russian intelligence officers and its other actions, and for a time seemed willing to offer him some form of immunity from prosecutions in exchange for his testimony, reaching out to his lawyers. But Assange’s release of the Vault 7 tools ended those negotiations.

Senior Justice Department officials pushed in 2017 to declare internally that WikiLeaks was not covered by special rules governing how investigators interact with journalists. The regulations require higher-level approval to obtain journalists’ records, like phone logs and e-mails, as part of investigations into leaks of classified information. By releasing hacking tools and playing a role in disrupting the election, Assange, the senior officials argued, was acting more like an agent of a foreign power than a journalist.

Prosecutors began working on a sealed criminal complaint this summer, a former law enforcement official said.

Charges against Assange would be a big step, said Joshua Geltzer, a former Justice Department official. But, he added, the precise nature of the charges may not be known until Assange is in the custody of U.S. officials. Assange has lived in the Ecuadorian Embassy in London since 2012.