A military judge ruled Tuesday that Army Pfc. Bradley E. Manning violated the Espionage Act when he gave a trove of classified material to the anti-secrecy group WikiLeaks to publish online.

But Army Col. Denise Lind found the onetime Marylander not guilty of aiding the enemy — the most serious charge brought by the government, which carries a possible life sentence.

Manning, 25, could still be sentenced to decades in prison for leaking hundreds of thousands of war logs, diplomatic cables and battlefield video footage in the largest security breach in U.S. history. Maximum terms for the 20 counts of espionage, theft and disobeying regulations on which he was convicted add up to 136 years behind bars.

The sentencing phase of his court-martial is scheduled to begin Wednesday at Fort Meade. Both sides can present arguments. Manning, who did not testify during the eight-week trial phase, may speak before Lind orders a punishment.

On Tuesday, the slight, bespectacled soldier stood at attention as Lind read her verdict on each of the 21 counts. Manning remained impassive, but his attorney smiled faintly when Lind ruled that he was not guilty of aiding the enemy.

He is expected to appeal the rest of the findings.

The proceeding has drawn worldwide attention to the small courtroom on the Army base in Anne Arundel County.

To his supporters, Manning is a whistle-blower whose release of gun-sight video footage of a U.S. helicopter crew killing civilians in Baghdad and laughing revealed evidence of a possible war crime. To others, he is a traitor whose release of classified materials endangered American lives.

His court-martial unfolded as disclosures by another young intelligence worker provoked a continuing debate over national security, government secrecy and privacy rights. Edward Snowden, the former National Security Agency contractor who revealed details of secret U.S. telephone and Internet surveillance programs, called Manning "a classic whistle-blower."

"It is a short-sighted judgment that cannot be tolerated and must be reversed," Assange said from the Ecuadorean Embassy in London, where he has been living to avoid extradition to Sweden to face allegations of sex crimes. "It can never be that conveying true information to the public is 'espionage.'"

Daniel Benjamin, until last year the State Department's chief counterterrorism official, called the belief of Manning's supporters that he was working for the greater good "perverse."

"We need to have whistle-blowers who illuminate wrongdoing. But they focus on specific deeds, such as My Lai" — the massacre of Vietnamese civilians by U.S. troops. "[Manning] didn't focus. He dropped 750,000 documents on the public. This was a profoundly reckless act.

"If you can talk about vandalism against the U.S.' standing in the world ... this was it," said Benjamin, who now heads the John Sloan Dickey Center for International Understanding at Dartmouth College. "Clearly, it's important that he's convicted, and it's important that he's going to be incarcerated for a long time."

Former Air Force attorney Scott L. Silliman, now a professor at Duke Law School, said that "the dialogue is going to go on."

"It's going to continue to be how you look at Bradley Manning," Silliman said. "Is he a hero? Is he someone who did great damage to the country?"

Manning lived with an aunt in Potomac and studied at Montgomery College before he enlisted in the Army in 2007. He served in Iraq from 2009 until his arrest in Baghdad in May 2010.

Before Lind read her verdict, analysts had said that a Manning conviction on aiding the enemy would have expanded the definition of the charge.

Traditionally, the law has been used to prosecute individuals suspected of giving information directly to a U.S. adversary. Manning gave material to WikiLeaks to publish on the Internet.

Prosecutors argued that he knew from his training that al-Qaida and other enemies would see it there. They said Osama bin Laden had asked for the war logs that Manning leaked and that copies were found in the terrorist leader's compound in Pakistan after he was killed by Navy SEALs.

Civil liberties advocates and Manning's supporters argued that a guilty finding would have cast a broad chilling effect on whistle-blowers and the media organizations that publish their revelations.

The Government Accountability Project, which has defended leakers, including former NSA official Thomas Drake, called the not-guilty finding "a just outcome to an unprecedented case of judicial overreach."

"Even the potential of a ruling in favor of aiding the enemy arguably has a chilling effect on journalists and free speech," the group said in a statement. "In essence, it would have put any author of materials found in the hands of a designated enemy of the United States at risk of being found guilty of aiding the enemy."

Silliman, who is director emeritus of the Center on Law, Ethics and National Security at Duke, said the finding was not a surprise. "Giving aid to the enemy is a very serious charge," he said. "It's a very heavy burden of proof that Manning knew the information he was releasing would be used by the enemy."

Elizabeth Goitein of New York University's Brennan Center for Justice called the espionage conviction "a scary precedent."

"Manning is one of very few people ever charged under the Espionage Act prosecutions for leaks to the media," said Goitein, co-director of the center's Liberty and National Security Program. "Despite the lack of any evidence that he intended any harm to the United States, Manning faces decades in prison."

The source of the leak was not in dispute. Manning acknowledged having given the materials to WikiLeaks, including the video footage of the 2007 Apache helicopter attack in Baghdad, which was posted online by the group as "Collateral Murder."

At a pretrial hearing, Manning said he wanted to provoke a public debate about U.S. military and foreign policy.

During the court-martial, the sides focused largely on his motives, state of mind and intent.

Prosecutors called him arrogant and disloyal, and said he was seeking "worldwide notoriety."

His lawyers called him a whistle-blower and said he was well-intentioned but naive. They said he went to Iraq hoping to protect U.S. troops and Iraqi civilians but became troubled by what he saw. They also said he was struggling with gender identity disorder.

Manning has been detained since his arrest. Lind ruled earlier this year that he was mistreated at the Marine Corps Brig at Quantico, Va., where he was held in 2010 and 2011, and credited him with 112 days off any eventual sentence.

Before and after the verdict Tuesday, Manning supporters rallied outside the main gate to Fort Meade on Route 175, waving signs that read "Free Bradley" and wearing T-shirts emblazoned with the word "truth."

Baltimore activist Max Obuszewski, a Manning supporter, said he had been "skeptical of any good news happening" Tuesday. But when Lind "had the spine and the backbone" to find Manning not guilty of aiding the enemy, he said, he was "ecstatic."

"The work continues," Obuszewski said. "Now we have to get him out of jail."

Benjamin, the former State Department official, said Manning's critics face a disadvantage in the court of public opinion: Even talking about the damage wrought by the release of diplomatic cables serves to highlight the content that should have remained secret.

Security analyst Edward Snowden, who is also a former CIA employee, has come forward to claim responsibility for revealing U.S. telephone and Internet surveillance, a capability he finds "horrifying." Snowden says he leaked documents about a secret surveillance program run by the U.S. government...

After shooting down the state's request for disaster aid for the second time last week, the Federal Emergency Management Agency said Maryland could recover costs associated with rioting that broke out after the death of Freddie Gray in other ways.