Pte First Class Bradley Manning has apologised for hurting the US by leaking a trove of classified US government documents to Wikileaks.
At a sentencing hearing in Fort Meade, Maryland, Pte Manning, 25, said he had mistakenly believed he could “change the world for the better”.
And he said that in retrospect, he should have worked “inside the system”.
Pte Manning, 25, faces up to 90 years in prison following his conviction in July on 20 espionage and other charges.
In an unsworn statement at the hearing in the sentencing phase of his court martial, Pte Manning said: “I’m sorry that my actions hurt people. I’m sorry that it hurt the United States.
“I’m apologising for the unexpected results of my actions. The last three years have been a learning experience for me.”
Last month, military Judge Col Denise Lind convicted Pte Manning of 20 charges including espionage, theft and violating computer regulations.
He had already admitted passing hundreds of thousands of battlefield reports and diplomatic cables to Wikileaks while stationed in Iraq in 2010, saying in a pre-trial hearing he had leaked the secret files in order to spark a public debate about US foreign policy and the military.
In his brief statement on Wednesday, Pte Manning said he had come to realise he should have worked “more aggressively inside the system” to make the changes he sought.
“When I made these decisions I believed I was going to help people, not hurt people,” he said.
“Unfortunately, I can’t go back and change things.”
Pte Manning also said he understood he must “pay a price” for his actions, but hoped one day to go to university and have a meaningful relationship with his sister and other family members.
The sentencing phase of the trial has focused on how much damage the Wikileaks revelations caused. The prosecution has called witnesses who described the impact on US diplomatic relations and on the military’s dealings with Afghan civilians, among other effects.
Pte Manning has said he never intended to harm US national security.
Meanwhile, on Wednesday the organisation that received and published the leaked documents, Wikileaks, said the statement was “extorted from him under the overbearing weight of the United States military justice system”.
“Mr Manning’s forced decision to apologise to the US government in the hope of shaving a decade or more off his sentence must be regarded with compassion and understanding,” the anti-secrecy group said.
Ahead of Pte Manning’s statement, Navy Capt David Moulton, a psychiatrist, testified that at the time of the leak he felt abandoned by friends and family and had hit a rough patch with his boyfriend amid an isolating deployment.
The psychiatrist interviewed Pte Manning for 21 hours after his arrest.
Pte Manning had also decided he wanted to become a woman, Capt Moulton said.
In psychiatric terms, Pte Manning has a “gender identity disorder”, or “disturbance of one’s gender”, Capt Moulton said.
This is different from being gay, he added.
“Gender is very much at the core of our identity,” he said, adding that when a person is uncertain about his or her gender, the whole world seems “off-keel”.
Pte Manning referred to these issues in his statement, saying they were “ongoing” and “a considerable difficulty in my life” but no excuse for his actions.