FORT MEADE, Md. -- The U.S. soldier charged in the biggest security breach in the country's history spoke publicly for the first time, saying he feared dying in custody after his arrest in Iraq for allegedly sending classified information to the secret-spilling website WikiLeaks.

"I remember thinking I'm going to die. I'm stuck inside this cage," a sometimes nervous Bradley Manning told a pretrial hearing Thursday, describing the nearly two months in 2010 he spent in a cell at an Army installation in Kuwait before he was moved to the U.S."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 Virginia. His lawyers are seeking dismissal of all charges, saying his pretrial confinement there was needlessly harsh.

Sometimes stumbling over his words, the 24-year-old intelligence analyst said he was held for nine months in highly restrictive maximum custody in the brig. "I started to feel like I was mentally going back to Kuwait mode, in that lonely, dark, black hole place, mentally."

He spent up to 23 hours a day in a small windowless cell. He described it as "boredom. Complete, out-of-my-mind boredom."

At one point during more than five hours of testimony, Manning put on a 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 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.

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

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

He also had to sleep naked for several nights.

The military contends the treatment was proper, given Manning's classification at the time 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 lesser charges for sending classified documents to the WikiLeaks website. Those offences carry a total maximum prison term of 16 years.

The ruling doesn't mean the pleas have been formally accepted. That could happen in December. But the judge approved the language of the offences to which Manning has said he would admit.

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 offence carries a maximum penalty of life in prison.

Under the proposal, Manning would admit to wilfully sending 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.