FORT MEADE, Md. – 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 attorneys 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 24-year-old intelligence analyst with rimless eyeglasses 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.

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 that if he really wanted to hurt himself, he could use his underwear waistband.

Before receiving the smock, Manning said he was once forced to stand naked at attention for morning count.

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. The ruling doesn’t mean the pleas have been formally accepted. That could happen in December. But the judge approved the language of the offenses to which Manning has said he would admit.