Days before his trial was set to begin, former National Security Agency manager and accused leaker Thomas A. Drake accepted a plea deal from the government Thursday that drops the charges in his indictment, absolves him of mishandling classified information and calls for no prison time.

In exchange, Drake, who was facing 35 years in prison if convicted of violating the Espionage Act, will plead guilty to a misdemeanor of exceeding authorized use of a computer. He will pay no fine, and the maximum probation time he can serve will be capped at one year.

“It’s an unambiguous victory for Drake,” said Jesselyn Radack, director of national security at the Government Accountability Project, who supported Drake on whistleblower issues. “The prosecution’s case imploded.”

The deal brings to a close a five-year ordeal for Drake, 54, who came under investigation in 2006 in leaking to the media and who was indicted in May 2010 on allegations of willful retention of “national defense” or classified information, obstruction of justice and making a false statement.

It also is a setback for the Obama administration’s effort to punish alleged leakers of national security secrets using a widely criticized World War I-era law.

Thomas Drake, 54, could face 35 years in prison if convicted of “willful retention of national defense information.” (Jacquelyn Martin/ASSOCIATED PRESS)

“As a tool for prosecuting leakers, the Espionage Act is a broad sword where a scalpel would be far preferable,” said Stephen Vladeck, a constitutional law professor at American University. “It criminalizes to the same degree the wrongful retention of information that probably should never have been classified in the first place and the willful sale of state secrets to foreign intelligence agencies.”

Justice Department spokeswoman Laura Sweeney said she could not comment on a pending matter.

Drake, who is set to appear in U.S. District Court in Baltimore on Friday morning before Judge Richard Bennett to enter the plea, has asserted all along that he never passed classified information to a Baltimore Sun reporter who wrote stories exposing NSA mismanagement.

On Wednesday, he rejected two offers from prosecutors but agreed Thursday afternoon to a deal that included no admission of sharing classified information, according to people following the case. He has said repeatedly that he would “never plea bargain with the truth.”

A statement of facts entered with the court Thursday by prosecutor William M. Welch II noted that from 2006 to 2007, Drake obtained information from NSA’s intranet and shared it with an unauthorized person, a reference to the reporter. “In doing so, the defendant knew that he exceeded his authorized use of NSANet,” the statement said.

A key ruling last Friday set the stage for Thursday’s deal. The judge denied the government permission to keep secret certain references to classified technology on grounds that it would harm Drake’s right to mount a defense. As a result, the prosecution on Sunday said it would withdraw and redact several sets of documents that were crucial to proving the most serious Espionage Act charges.

Drake has acknowledged communicating with reporter Siobhan Gorman, now with the Wall Street Journal but said it was to help her in her scrutiny of technology programs at the NSA.

Drake and several former NSA colleagues were concerned about what they saw as corruption in the NSA’s handling of a $1.2 billion data-sifting program, Trailblazer. He was also concerned about the launch of a massive NSA program to collect without court approval Americans’ e-mails and phone calls and run them through data-mining programs, an effort that became known informally as warrantless wiretapping.

He has said he tried to raise these concerns through proper channels — his superiors, the NSA inspector general and general counsel, and later the Pentagon inspector general. When he seemed to get no response, he took the “nuclear option,” friends said, and turned to Gorman.

Staff researcher Julie Tate contributed to this report.