An American military judge this week sentenced Army Private Bradley Manning to 35 years in prison for espionage. Manning provided more than 700,000 classified files and other materials to the anti-secrecy website WikiLeaks. Officials have described the case as the largest leak of restricted documents in American history.

The judge, Colonel Denise Lind, announced the sentence Wednesday at a military base in Maryland. She said the 25-year-old former intelligence specialist would be dishonorably discharged from the armed forces. He will be barred from future military service and lose rights to any pay he is owed.

The Oklahoma native has already spent three years in detention. He had faced as long as 90 years in prison for providing American secrets to WikiLeaks. Government lawyers called for a 60-year sentence. Under military rules, Manning could be considered for a conditional release from prison in less than nine years.

The sentencing followed a 12-week trial and a long legal battle over the release of hundreds of thousands of records. They included diplomatic messages and American battlefield reports from Iraq and Afghanistan. One video showed an American helicopter attack that killed two civilians.

Manning says he wanted to show the wrongfulness of war and American actions overseas. But government lawyers say he betrayed his country.

Morris Davis formerly served as the government’s main lawyer in cases against accused terrorists at Guantanamo military base in Cuba. He says the Manning case required a strong sentence. He adds that the information given to WikiLeaks did more to damage the image of the United States than harm national security.

“There was no real value to al-Qaida or anyone else from these classified documents when they could go on Google and get the same information. It’s hard to see where there’s any real harm here other than just embarrassment to the United States government.”

The judge cleared Manning of the more serious charge of aiding the enemy.

In court, Manning expressed regret for harming the country. The soldier and his lawyers said he had idealistic goals in releasing the information. They said he believed he could publicize the truth about American involvement in the wars in Iraq and Afghanistan.

His lawyer, David Coombs, compared Manning’s actions to anyone who exposed wartime truths. He called the case a defining event in press freedom that threatens the flow of information to the public.

The case raised questions about why the Army put Manning in a sensitive position. The court heard evidence that he had emotional problems. A military doctor described him as having a gender identity disorder. Manning did not receive treatment while in Iraq.

On Thursday, Manning announced that he is female and wants to live as a woman named Chelsea.

Tommy Sears heads the Center for Military Readiness. The group has criticized the military’s cancellation of a ban on homosexuals openly serving in the armed forces. He says the leaks might not have happened if Manning had been given help for his emotional issues.