The US soldier convicted of handing a trove of secret government documents to anti-secrecy website Wikileaks has been sentenced to 35 years in prison.
Pte First Class Bradley Manning, 25, was convicted in July of 20 charges against him, including espionage.
Last week, he apologised for hurting the US and for "the unexpected results" of his actions.
Prosecutors had asked for a 60-year sentence in order to send a message to future potential leakers.
Pte Manning will receive a credit against his sentence of about three and a half years, including time he has already served in jail and 112 days in recompense for the harsh conditions of his initial confinement.
He could be eligible for parole in about 11 years.
On Twitter, Wikileaks called the sentence a "significant strategic victory".
In the military courtroom in Fort Meade, Maryland, on Wednesday, Judge Col Denise Lind declared Pte Manning would be demoted to private and dishonourably discharged from the US Army, and forfeit his pay.
Guilty: Seven out of eight espionage charges, five theft
charges, two computer fraud charges, five military counts
of violating a lawful general regulation, one of wanton
publication of intelligence on the internet
Not guilty: Aiding the enemy, unauthorised possession
of information relating to national defence
While stationed in Iraq in 2010, the junior intelligence analyst passed hundreds of thousands of battlefield reports and diplomatic cables to Wikileaks, the pro-transparency group headed by Julian Assange.
Pte Manning has said he leaked the secret files in the hopes of sparking a public debate about US foreign policy and the military.
In a statement during the sentencing hearing, Pte Manning told the court martial at Fort Meade, Maryland that "the last three years have been a learning experience for me".
He said he mistakenly believed he could change the world for the better, and that in retrospect, he should have worked "inside the system".
His defence lawyers are expected to make a statement later on Wednesday.
The verdict and sentence will be reviewed, and possibly reduced, by a military district commander and will be automatically reviewed by the Army Court of Criminal Appeals.
Pte Manning may also petition the court for lenience during the appeals process.
He is expected to serve his sentence at Fort Leavenworth, Kansas.
Meanwhile, Amnesty International and the Bradley Manning Support Network have announced an online petition asking President Barack Obama to pardon Pte Manning.
The young soldier grew up in Oklahoma and in Wales, where his mother is from, and reportedly joined the US Army to help pay for college.
As an intelligence analyst, he had access to a large amount of very sensitive information, despite his junior rank. He deployed to Iraq in 2009.
A military psychiatrist testified that Pte Manning had struggled with his gender identity and wanted to become a woman at the time of the leak.
The BBC's Rajini Vaidyanathan at Fort Meade: "The
prosecution will be disappointed that the sentence is
Navy Capt David Moulton testified that Pte Manning had felt abandoned by friends and family and that his relationship with his boyfriend had hit a rough patch.
According to evidence presented by the defence, military supervisors ignored Pte Manning's erratic behaviour, which included trying to grab a gun during a counselling session.
'In a cage'
His lawyers said such actions had shown that Pte Manning had not been fit for duty overseas.
Defence lawyers said Pte Manning was treated unfairly in solitary confinement in Quantico, Virginia and in a cell at Camp Arifjan, a US Army installation in Kuwait.
Pte Manning told the court he remembered thinking: "I'm going to die, I'm stuck inside this cage."
The leaks enabled Wikileaks to publish sensitive messages between US diplomats and records of military incidents in the wars in Iraq and Afghanistan, as well as a cockpit video showing a US Apache helicopter killing 12 people in the Iraqi capital in 2007.
The revelations caused significant embarrassment to the US government, and US officials have said the disclosures damaged US relations with its allies and disrupted the war effort in Afghanistan.