Wikileaks founder Julian Assange raises his fist prior to addressing the media on the balcony of the Embassy of Ecuador in London on May 19, 2017.

The filing was first spotted by Seamus Hughes, a former counterterrorism official in government who is the deputy director of extremism program at George Washington University.

In a statement obtained by NBC News, Joshua Stueve, a spokesman for the U.S. attorney in the Eastern District of Virginia, said the filing "was made in error. That was not the intended name for this filing."

The complaint, prosecutors wrote in the document, "would need to remain sealed until Assange is arrested in connection with the charges in the criminal complaint and can therefore no longer evade or avoid arrest and extradition in this matter." At a separate point in the document, prosecutors wrote that "due to the sophistication of the defendant and the publicity surrounding the case, no other procedure is likely to keep confidential the fact that Assange has been charged."

The revelation was an accident. Prosecutors pursuing an unrelated sex crimes case, against a man named Seitu Sulayman Kokayi, referenced Assange twice in a filing seeking to keep the complaint against Kokayi under seal.

The Justice Department has apparently prepared to indict Wikileaks founder Julian Assange, setting up a legal battle that could have broad ramifications for the investigations into Russian interference in the 2016 election as well as the government's prosecution of journalists and others who publicize national security secrets.

Assange is a key figure in special counsel Robert Mueller's inquiry into possible links between the Trump campaign and Russia because of the role his anti-secrecy organization played in disseminating damaging information about Hillary Clinton.

In an indictment obtained in July, Mueller's prosecutors alleged that 12 Russian intelligence officers used Wikileaks as a conduit to "expand their interference in the 2016 U.S. presidential election." Referring to Wikileaks as "Organization 1," Mueller charged that the Russians, "posing as Guccifer 2.0, discussed the release of the stolen documents and the timing of those releases with Organization 1 to heighten their impact on the 2016 U.S. presidential election."

The relevance of Wikileaks to the government's investigation has been in the limelight in recent weeks amid an uptick of grand jury activity related to the conservative provocateur and Trump associate Roger Stone, who claimed to be in talks with Wikileaks in 2016.

In August of that year, Stone said on a conference call that "Julian Assange is going to continue to drop information on the American voters that is going to roil this race." In October, the organization released the first stolen emails from Clinton campaign chairman John Podesta. A previous batch of stolen documents had been released in July.

Donald Trump trumpeted the leaks on the campaign trail. In a now-famous news conference in July 2016, then-candidate Trump said: "Russia, if you're listening, I hope you're able to find the 30,000 emails that are missing." Mueller has alleged that Russia's first attempt to hack Clinton's personal servers came that same day.

Stone has denied any wrongdoing and has said there was no collusion with Russia. Text messages he provided to NBC News show that he was receiving updates from Assange through an associate before Wikileaks began dumping Podesta's stolen documents.

The president's eldest son, Donald Trump Jr., was also in contact with Wikileaks during the 2016 election, and has handed over his correspondence to congressional investigators. His attorney, Alan Futerfas, has said he has "no concerns about these documents and any questions raised about them have been easily answered in the appropriate forum."

Wikileaks has vocally defended its founder, who is currently holed up in the Ecuadorean Embassy in London, since the Virginia court filing surfaced. In a statement, Wikileaks noted that the filing was not signed by Mueller or his prosecutors, and added that "WikiLeaks has never been contacted by anyone from his office."

Assange entered the embassy in 2012 claiming diplomatic asylum. He was wanted at the time in Sweden for alleged sex crimes. That case was dropped in 2017, but Assange's lawyers have said that he will not exit the embassy until he is assured that he will not be prosecuted by the U.S. on espionage charges. The U.S. has become increasingly optimistic that it could prosecute Assange in an American courtroom, The Wall Street Journal reported.

"The news that criminal charges have apparently been filed against Mr. Assange is even more troubling than the haphazard manner in which that information has been revealed," Assange's attorney in the United States, Barry Pollack, said in a statement to NBC News. "The government bringing criminal charges against someone for publishing truthful information is a dangerous path for a democracy to take."

Later, he told CNBC: "We have not been informed that Mr. Assange has been charged or the nature of any charges. We have simply seen what the government filed in an unrelated case saying that Mr. Assange has been charged." Pollack also said it was too early to tell whether Assange would pursue any legal action over the matter.