An Army private charged in the biggest security breach in U.S. history testified Thursday that he felt like a doomed, caged animal after he was arrested in Baghdad for allegedly sending classified information to the secret-spilling website WikiLeaks.

Speaking publicly for the first time about his May 2010 arrest and subsequent confinement, Pfc. Bradley Manning addressed the nearly two months he spent in a cell in a segregation tent at Camp Arifjan, an Army installation in Kuwait, before he was moved stateside.

"I remember thinking I'm going to die. I'm stuck inside this cage," Manning said in response to questions from defense attorney David Coombs. "I just thought I was going to die in that cage. And that's how I saw it — an animal cage."

Manning was later sent to a Marine Corps brig in Quantico, Va., in July 2010. His lawyers are seeking dismissal of all charges, contending his pretrial confinement at Quantico was needlessly harsh.

Manning's testimony came on the third day of a pretrial hearing at Fort Meade, the sprawling Army post between Washington and Baltimore.

The compact, 24-year-old intelligence analyst looked youthful in his dark-blue dress uniform, close-cropped hair and rimless eyeglasses. He was animated, often swiveling in the witness chair and gesturing with his hands.

Speaking in emphatic bursts, sometimes stumbling over his words, Manning said that at Quantico, where he was held for nine months in highly restrictive maximum custody, "I started to feel like I was mentally going back to Kuwait mode, in that lonely, dark, black hole place, mentally."

Manning said he never sank that low but grew frustrated after five months in which he spent up to 23 hours a day in a windowless, 6-by-8-foot cell.

"It was pretty draining. Tiring," Manning said.

He described it as "boredom. Complete, out-of-my-mind boredom."

At one point during more than five hours of testimony, Manning donned a dark-green, suicide-prevention smock resembling an oversized tank top made of stiff, thick fabric. He said it was similar to one he was issued in March 2011, several days after Quantico jailers started requiring him to surrender all his clothing and eyeglasses each night as a suicide-prevention measure. This occurred after he told them — out of frustration at his restrictions, he said — that if he really wanted to hurt himself, he could use his underwear waistband.

During that period, before receiving the smock, Manning said he was once forced to stand naked at attention for morning count.

"I had no socks, no underwear, I had no articles of clothing, I had no glasses," he said.

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 Quantico, where he also 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 was willing to plead guilty to eight charges for sending classified documents to the 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 has said he 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.

Other prospective witnesses include a military psychiatrist who examined Manning at Quantico, and the former commander of the confinement facility at Fort Leavenworth, Kan., where Manning was later moved, re-evaluated and given a medium-security classification.