Army Pfc. Bradley Manning was sentenced to 35 years in prison Wednesday after being convicted of espionage and other charges in connection with a massive leak of classified material.
He also received a dishonorable discharge, will forfeit his pay and benefits and was reduced in rank.
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 one of the largest leaks of classified material in U.S. history and was at the center of a growing debate over government secrecy.
Supporters of Manning consider him a whistleblower whose exposures served the public interest. The American Civil Liberties Union criticized his sentencing.
The government said Manning was a traitor who hurt the country.
The judge in the case, Army Col. Denise Lind, announced the sentence in a military courtroom in Fort Meade, Md.
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 of his sentence.
Eugene Fidell, who teaches military justice at Yale Law School, said he thought the sentence "was a bit on the high side," but that defense attorneys had a tough case.
Follow @jimmichaels on Twitter.
Contributing: Associated Press