Bradley Manning hoped to use his knowledge of politics, world affairs, philosophy, art and science to better serve his military commanders and save lives in the battlefield of Iraq, his court martial trial in Fort Meade, Maryland, has heard.

As the defence phase got under way at the most significant trial of an official leaker for decades, the court heard Manning's own words uttered just months before he began transmitting hundreds of thousands of classified documents to WikiLeaks. "im reading a lot more, delving deeper into philosophy, art, physics, biology, politics then i ever did in school [sic]," Manning was heard to have written in early 2009. "whats even better with my current position is that i can apply what i learn to provide more information to my officers and commanders, and hopefully save lives."

Manning's comments were presented to court through testimony from Lauren McNamara, a transgender woman whom Manning befriended online shortly before his deployment to Iraq in November 2009. McNamara read to the court from a web chat that she engaged in with the army private between February and August 2009.

McNamara, who was a man at the time of the chat called Zachary Antolak, told the court that Manning had shared with her his views on politics, global affairs and his private life. "We were just a couple of people talking about our lives, and he shared his various experiences and interests."

McNamara said that Manning had been concerned about saving the lives of families in other countries, of non-combatants and soldiers alike. Reading from the chats, she quoted the soldier's own remark that "im more concerned about making sure that everyone, soldiers, marines, contractor, even the local nationals, get home to their families."

In drawing out the views that Manning held shortly before he was sent to Iraq, the defence is walking a very fine legal line. The presiding judge, Colonel Denise Lind, has ruled in pre-trial hearings that the defence is not allowed to present evidence on the army private's motives for leaking to WikiLeaks – that must be held back to the sentencing phase of the court martial, if presented at all.

However, the defence is allowed to raise issues of Manning's state of mind at the time he carried out the leaks. What he was thinking in terms of his work and the value of intelligence is relevant to the two most serious charges facing him: that he "aided the enemy" by handing WikiLeaks sensitive intelligence that could then be accessed via the internet by al-Qaida; and that he violated the 1917 Espionage Act by "wantonly" causing to be published on the internet intelligence that could be "used to the injury of the US or to the advantage of any foreign nation".

Prosecutors initially tried to stop the defence from drawing on the web chat between Manning, who used the internet handle bradass87, and McNamara, who used the pseudonym ZJ. But the government's complaint that the exchange was hearsay was dropped after Lind indicated she would allow the testimony to proceed.

In further extracts from the web chats read out to court by McNamara, Manning was heard to say that he hoped to enter politics upon completing his military career. "my plan is pretty simple but vague... get credentials, nice ones... ones that make it difficult for really creepy conservative people to attack... then jump into politics".

Under cross-examination, other extracts from the web chats were cited to paint Manning in a very different light. He was quoted in the online dialogue as saying "Activism is fun", adding that "worryingly, 'terrorists' are a form of political activist, however, they recruit young people with troubled lives…"

The prosecution also quoted Manning as being critical of the military, saying: "military is all f'd up... contracts with closed source developers with incompatible software... drives me NUTS".

As a final passage, prosecution lawyers asked McNamara to read an excerpt from the web chats in which Manning had discussed classified information. The passage spoke to the government's intention to prove that the soldier had knowledge that classified intelligence could be used by the enemy to the detriment of the US.

Referring to the detainees at Guantánamo, Manning wrote that "some of them are actually pretty dangerous indeed... some of them weren't dangerous before, but are now in fact dangerous because we imprisoned them for so long (don't quote me on that, for the love of my career)".

He added that it was often impossible to tell which of the detainees would be dangerous if they were released and which would fit peacefully back into society. "the reason thats difficult: the things we have tried them on are classified information, connected with other pieces of classified information... so if a trial is done, it might have to be done in some kind of modified trial, where pieces of evidence which are classified are presented only in a classified environment," he wrote.