Pfc. Bradley Manning testified on the third day of a pretrial hearing at Fort Meade, outside Baltimore.
Wearing his dress uniform, he appeared nervous, stuttering over his words as he tried to answer questions from a defense attorney about his arrest in Baghdad in May 2010. He was testifying only about his arrest and confinement.
Seated in the witness booth, he swiveled back and forth and gestured with his hands as he described the layout of his confinement quarters overseas.
Manning is trying to avoid trial in the WikiLeaks case. He argues he was punished enough when he was locked up alone in a small cell for nearly nine months at a brig in Quantico, Va., and had to sleep naked for several nights.
The military contends the treatment was proper, given Manning's classification then as a maximum-security detainee who posed a risk of injury to himself or others.
Earlier Thursday, a military judge accepted the terms under which Manning would plead guilty to eight charges for sending classified documents to the secret-spilling WikiLeaks website.
Col. Denise Lind's ruling doesn't mean the pleas have been formally accepted. That could happen in December.
But Lind approved the language of the offenses to which Manning would admit.
She said those offenses carry a total maximum prison term of 16 years.
Manning made the offer as a way of accepting responsibility for the leak. Government officials have not said whether they would continue prosecuting him for the other 14 counts he faces, including aiding the enemy. That offense carries a maximum penalty of life in prison.
Under the proposal, Manning would admit to willfully sending the following material: a battlefield video file, some classified memos, more than 20 Iraq war logs, more than 20 Afghanistan war logs and other classified materials. He would also plead guilty to wrongfully storing classified information.
Meanwhile, Manning's lawyers are arguing that the charges against the soldier should be dismissed because of how he was treated while confined at Quantico.
Other prospective witnesses include a military psychiatrist who examined Manning at Quantico, and the former commander of the confinement facility at Fort Leavenworth, Kan. Manning was later moved there, re-evaluated and given a medium-security classification.