FORT MEADE, Md. — Pfc. Bradley Manning, who is facing up to 90 years in prison for leaking 700,000 government files to WikiLeaks, apologized on Wednesday for the “unintended consequences of my actions.” He told the judge at his court-martial trial that while he “believed it was going to help people, not hurt people,” he now realized that what he did was wrong.

“I’m sorry that my actions hurt people,” he said. “I’m sorry that they hurt the United States. At the time of my decision, as you know, I was dealing with a lot of issues, issues that are ongoing and continue to affect me” — a reference to matters like his crisis over his gender identity, which he was confronting while on a military deployment in a combat zone.

Throughout the case, open-government activists have celebrated Private Manning’s leaks as a heroic act to be admired and emulated even as his critics have denounced him as a traitor. And earlier in his court-martial, Private Manning’s defense lawyer, David E. Coombs, portrayed his client as a whistle-blower, even if a naïve one. But in the sentencing phase this week, Mr. Coombs has elicited testimony that depicted his client as a smaller, sadder figure — a damaged and confused young man whose decision-making capacity when he decided to leak the files was impaired by extraordinary stress.

In his statement, Private Manning said these personal issues did not justify the things he did.

“Although a considerable difficulty in my life,” he said, “ these issues are not an excuse for my actions. I understood what I was doing and the decisions I made. However, I did not fully appreciate the broader effects of my actions. Those factors are clear to me now.”