WASHINGTON — A former spy agency employee agreed late Thursday to plead guilty to a minor charge in a highly publicized leak prosecution, undercutting the Obama administration’s unusual campaign to prosecute government officials who disclose classified information to the press.

The National Security Agency official, Thomas A. Drake, had faced a possible 35 years in prison if convicted on felony charges under the Espionage Act. Instead, he agreed to admit to a misdemeanor of misusing the agency’s computer system by providing “official N.S.A. information” to an unauthorized person, a reporter for The Baltimore Sun. Prosecutors said in the written plea agreement that they would not oppose a sentence under which Mr. Drake would serve no time.

A formal plea hearing was set for Friday morning in Baltimore. The presiding judge, Richard D. Bennett of the district court, could impose a sentence of up to a year in prison. But legal experts said it would be highly unusual to impose a prison term when the Justice Department was not seeking incarceration.

The deal represented the almost complete collapse of the government’s effort to make an example of Mr. Drake, who was charged last year in a 10-count indictment that accused him of obstructing justice and lying to investigators. It is uncertain whether the outcome will influence the handling of three pending leak cases or others still under investigation.