Yesterday, 25-year-old former Army intelligence analyst Bradley Manning admitted he gave all those documents to Wikileaks and attempted to explain why he did it. In the Wikileaks debate Manning is typically cast as either a a heroic whistleblower or a seditious traitor, or as a confused kid acting out in an emotional tantrum. What's remarkable about Manning's own account is how it fits none of those characterizations. We see Bradley Manning the curious analyst become Bradley Manning the world's most famous leaker through a very personal relationship with Wikileaks that is inseparable from his own motives and psychological situation.

Yesterday's hearing at Ft. Meade, Maryland was the first time the world heard at length from Manning, who has been imprisoned for nearly three years. His entire 10,000-word statement, transcribed the journalist Alexa O'Brien, is a fascinating and complex document. It descends into labyrinthine technical detail about his duties as an intelligence analyst in Iraq then soars into high-minded principles of transparency and justice, often in the same paragraph. The rhetorical strategy fits the message: This is not a groveling apology or a rousing call to arms but a careful effort to intellectualize and rationalize Manning's disclosure to Wikileaks of thousands of confidential documents, for which he faces life in prison.

The story begins with Manning's own disillusionment with U.S. foreign policy and its wars, sparked by his wide-ranging research as an analyst. "I began to become depressed with the situation that we found ourselves increasingly mired in year after year," he said. He wanted to give the public access to some of the same information he had seen, so they might come to a similar conclusion. Manning said he leaked a massive database of incident reports from Iraq and Afghanistan because he believed they might "spark a domestic debate on the role of the military and our foreign policy in general as it relates to Iraq and Afghanistan." He hoped people who saw the dramatic video of a 2007 Apache helicopter strike in Iraq he leaked would be outraged by the "delightful bloodlust" of the pilots. The U.S. State Department cables he gave to Wikileaks detailed shady deals and backroom intimidation and were "a prime example of a need for a more open diplomacy."

But Manning's ideas and actions did not develop in a vacuum. In walking us through the genesis of and rationale behind each leak, Manning's statement emphasizes they were not hit-and-run jobs. Wikileaks plays a pivotal role in this story, and not just as a passive leaking "platform." As Manning tells it, his relationship with Wikileaks was not unlike the relationship between a traditional journalist and their source. Manning said he was originally drawn to Wikileaks after their release in 2009 of half a million pager messages from 9/11. In January, 2010, Manning joined a chatroom linked on Wikileaks' official site out of curiosity. He wanted to know how Wikileaks got the pager messages. "I am the type of person who likes to know how things work," he said in his statement. "And, as an analyst, this means I always want to figure out the truth."

Over the years I've periodically visited that same, now-defunct chatroom to try to figure out how Wikileaks works. Whenever I dropped by it seemed pretty dead, a few Wikileaks fanboys idling during the work day. But in early 2010 Manning found a lively collection of geeks discussing stimulating topics:

"Over a period of time I became more involved in these discussions especially when conversations turned to geopolitical events and information technology topics, such as networking and encryption methods. Based on these observations, I would describe the [Wikileaks] organization as almost academic in nature."

This became Manning's social circle. Manning, who is openly gay and possibly transgender, told the court he was having troubles with his roommate in Iraq because of his "discomfort regarding my perceived sexual orientation." But the crowd in the Wikileaks chatroom were the same kind of non-judgmental geeks who hung out at the Boston hacker space Manning had visited in real life in early 2010. The chats "allowed me to feel connected to others even when alone," he said in his statement. "They helped pass the time and keep motivated throughout the deployment."

Throughout his leaking, Manning said he developed an online friendship with an anonymous Wikileaks associate whom he called "Nathaniel," after Nathaniel Frank, the author of a popular book on Don't Ask Don't Tell. Manning presumed Nathaniel was one of the higher-ups in Wikileaks, Julian Assange or one of his lieutenants. The conversations with Nathaniel gave Manning particular solace during his difficult time in Iraq:

Our mutual interest in information technology and politics made our conversations enjoyable. We engaged in conversation often. Sometimes as long as an hour or more. I often looked forward to my conversations with Nathaniel after work.

If intense loneliness brought him closer to Wikileaks, could a desire to impress his new acquaintances have kept him feeding documents to Wikileaks? Manning said he was never pressured to leak to Wikileaks and that he takes "full responsibility" for his actions. But Manning's other chats from the time show an emotional frailness and eagerness to please, which ultimately betrayed him when he confided about his leaking to the hacker Adrian Lamo, who turned him in. At the very least, Manning's chats suggest that any emotional explanation for his leaking stemmed as much from becoming close to this freewheeling community of geeks and hackers as from the isolation and dissatisfaction with the U.S. government and his job.

The question of motives is crucial not just to Mannning's image but to his freedom. Manning has pleaded guilty to 10 of the 22 charges against him, but he pleaded not guilty to the more serious espionage charges, including "aiding the enemy." To nail Manning on this, prosecutors will have to prove he was knowingly, albeit indirectly, communicating to America's enemies through his Wikileaks disclosures. The aiding the enemy charge is frightening, because it's a clear attempt at intimidating potential future whistleblowers who come to the press with evidence of government wrongdoing. As the Harvard law professor Yochai Benckler writes "What kind of country makes communicating with the press for publication to the American public a death-eligible offense?" (Manning's prosecutors aren't seeking the death penalty in his case.)

The unspoken message of Manning's statement is that he wasn't aiding America's enemy: He was helping his friends.