A former intelligence analyst leaked classified information about drone warfare to a journalist and wrote anonymously about his experience in the national security establishment, he admitted Wednesday in Alexandria federal court.

Daniel Hale, 33, had been set to go on trial next week. He had argued that the Espionage Act charges against him violate the First Amendment — an unsettled legal question that is likely to be revived in the same courthouse should WikiLeaks founder Julian Assange be extradited to the United States.

Instead, Hale pleaded guilty to one count of violating the Espionage Act, punishable by up to 10 years in prison. He is scheduled to be sentenced July 13.

Hale, who admitted sharing eight secret and three top-secret documents, had no agreement with prosecutors to resolve the case. Four other charges remain pending against him. Judge Liam O’Grady indicated that Hale’s sentence would probably not change based on the number of convictions and said he would take up that issue at sentencing.

Raj Parekh, acting U.S. attorney for the Eastern District of Virginia, said in a statement Wednesday that Hale “knowingly took highly classified documents and disclosed them without authorization, thereby violating his solemn obligations to our country.”

In 2013, after four years in the Air Force working as an intelligence analyst at the National Security Agency, Hale became a contractor at the National Geospatial-Intelligence Agency. According to court records, as he was transitioning to the private sector, Hale reached out to a reporter who had just published a book about U.S. drone warfare. While the reporter is unnamed in court records, the description matches Jeremy Scahill, a founding editor of the Intercept.

Over the next year, according to court records, Hale shared top-secret documents with the reporter, who published them online and in a 2016 book. Scahill published a series on drones in the Intercept and wrote a book called “The Assassination Complex: Inside the Government’s Secret Drone Warfare Program.” The documents detailed the protocol for ordering drone strikes and shed light on civilian casualties and internal military debates over the accuracy of intelligence.

A chapter in the book, “Why I Leaked the Watchlist Documents,” was written by “Anonymous.” Hale admitted in court Wednesday to writing the chapter anonymously.

“These documents detailed a secret, unaccountable process for targeting and killing people around the world, including U.S. citizens, through drone strikes,” Intercept Editor in Chief Betsy Reed said in a statement after Hale’s indictment. “They are of vital public importance, and activity related to their disclosure is protected by the First Amendment.”

In January, Scahill urged the Biden administration to drop its case against Hale and pardon Reality Winner, a former government contractor who is serving a five-year sentence for leaking to the Intercept.

In a 2016 documentary, “National Bird,” Hale says he joined the Air Force at age 21 “out of desperation” but became increasingly disturbed by the process of identifying foreign targets through drones. Any “military age male” in the vicinity of a target was considered “legitimate,” he said. “There’s no way of knowing . . . if anyone I was involved in, kill or capture, was a civilian or not,” he said.

In court Wednesday, Hale said he was now focused on “taking care of and giving back to the people who supported me along the way.”

Jesselyn Radack, a human rights attorney who has worked with Hale, said: “It’s unfortunate to see the Biden administration’s continued use of this antiquated, heavy-handed law to punish whistleblowers and journalistic sources.”

In July 2016, President Barack Obama issued an executive order requiring annual disclosure of civilian drone casualties. But the measure was weakened under the Trump administration, which also relaxed standards for fatal strikes, according to a person familiar with the policy who spoke on the condition of anonymity because it has not been publicly released. The Biden administration has imposed temporary limits on drone strikes outside the battlefields of Afghanistan, Syria and Iraq while officials review that policy.