Manning sentence
US soldier Bradley Manning has been sentenced for leaked thousands of top-secret diplomatic cables to WikiLeaks (Reuters)

The man who leaked thousands of top-secret diplomatic cables to WikiLeaks has been sentenced to 35 years.

US soldier Bradley Manning, 25, was handed the sentence by a military court at Fort Meade, Maryland.

It was the longest prison term imposed on an American soldier for sharing government secrets in recent decades. 

Manning has also been dishonourably discharged from the military. His sentence was reduced by three and a half years for time already served.

He will be eligible for parole after serving at least a third of his term.

Prosecutors asked for a 60-year prison sentence at least, saying it would set an example for other soldiers. They argued that the leaks endangered the lives of US intelligence sources and prompted a number of ambassadors to be recalled, reassigned or expelled.

His defence team asked for a maximum 25-year sentence to allow Manning time to rebuild his life afterwards.

The whistleblower apologised to his country for the "unexpected results" of his leaks and begged for a chance to avoid a custodial sentence so that he could go to college and become a productive citizen.

"I believed I was going to help people, not hurt people," he said.

In July, military judge Col Denise Lind convicted Manning of 20 charges including espionage, theft and violating computer regulations.

Working as an army intelligence analyst in Iraq in 2010, Manning leaked confidential diplomatic cables, warzone logs and videos to the anti-secrecy website.

A psychiatrist told the court that the soldier had a troubled childhood and suffered from gender-identity disorder.

Capt David Moulton said that Manning felt he was a woman trapped inside a man's body and that that made him feel alienated in the army.

Attorneys for Manning contended that his commanders should have spotted signs of his deteriorating mental health and not send him to a warzone to handle classified information.

Manning emailed Capt Michael Worsley a photo of himself in a blonde wig and lipstick, describing his desire to become a woman and his hope that military life would "get rid of it".