Army Pfc. Bradley Manning was sentenced to 35 years in prison after being convicted of espionage and other charges in connection with a massive leak of classified material.
The judge in the case, Army Col. Denise Lind, announced the sentence in a military courtroom in Fort Meade, Md.
Manning faced a maximum of 90 years in prison after his conviction last month on charges of espionage, theft and fraud.
Manning was convicted of the largest leak of classified material in U.S. history and was at the center of a growing debate over government secrecy.
Prosecutors urged the judge to sentence Manning to 60 years as a deterrent to others who might be tempted to leak secret documents.
"He betrayed the United States, and for that betrayal, he deserves to spend the majority of his remaining life in confinement," Capt. Joe Morrow had said during the sentencing hearing.
Manning's defense had urged the military to sentence Manning, who served as an intelligence analyst in Iraq, to no more than 25 years in prison.
Manning leaked secret documents, which included battlefield reports and State Department cables, to WikiLeaks, which posted them on the Internet.
The U.S. government said his actions jeopardized U.S. interests and exposed informants and sources to danger. Manning's defense painted him as a misguided idealist who opposed the war in Iraq.
"He had pure intentions at the time that he committed his offenses," defense attorney David Coombs said during the sentencing hearing. "At that time, Pfc. Manning really, truly, genuinely believed that this information could make a difference."
Manning's defense attempted to "play up the human aspect" of Manning by highlighting mental health issues, said Phil Cave, a former military lawyer now in private practice
Defense witnesses testified about Manning's "gender-identity disorder," which contributed to the mental stress he was under.
During the sentencing hearing Manning had apologized for hurting the United States.
Under military law, the sentence will be automatically appealed. He would probably be eligible for parole after he served one-third or 10 years of his sentence, whichever is longer.