The court-martial of US soldier Bradley Manning has focused on his motivations for giving secrets to the WikiLeaks website in 2010.
Prosecutors on the second day of the court martial in Maryland also sought to show how he leaked documents and discussed it with others.
Private First Class Manning is accused of the biggest breach of classified information in US history.
Military prosecutors called to the witness stand an admitted computer hacker who befriended Pte Manning and then turned him in to US Army investigators.
The man, Adrian Lamo, testified that Pte Manning contacted him online in May 2010 from his base in Iraq, seeking guidance in encrypted online chats.
Mr Lamo described himself as a computer threat analyst and "grey hat hacker" - someone who breached computer systems but not for malicious purposes.
Mr Lamo considered Manning a kindred idealist, according to his testimony.
"Based on your conversation, you saw a 22-year-old with good intentions, just like you had been?" defence attorney David Coombs asked Mr Lamo.
"That was not lost on me," replied Mr Lamo, who pleaded guilty in 2004 to breaking into the computer systems of the New York Times, Microsoft and Lexis Nexis.
When the trial opened yesterday, prosecutors told the judge that Pte Manning had been driven by arrogance to leak more than 700,000 documents, combat videos and other data to the anti-secrecy website, WikiLeaks.
The website began exposing the leaked US government secrets in 2010, stunning diplomats and US officials.
Pte Manning has been in confinement since he was arrested in May 2010.
In opening arguments, lawyers for the 25-year-old described the former intelligence analyst in Iraq as naive but well intentioned in wanting to show the US public the reality of war in Afghanistan and Iraq.
Pte Manning could be sentenced to life in prison without parole if convicted.
He faces 21 charges, including the most serious one of aiding the enemy, and prosecution under the Espionage Act of 1917.
The judge, Colonel Denise Lind, said last month she would close parts of the trial to the public to protect classified material.
The trial is scheduled to run through late August at the earliest.