The United States soldier accused of passing thousands of secret documents to the Wikileaks website has been giving testimony for the first time before a US military judge.

Private Bradley Manning testified yesterday that he was confined to a "cage" in the early days after his arrest in 2010, and thought he would die there.

He said his isolation quickly led to a breakdown, and his military captors eventually put him on suicide watch.

"My nights were my days and my days were my nights," he said. "It all blended together after a couple of days."

He faces up to life in prison if convicted of charges he played a role in the massive leaking of secrets by WikiLeaks.

The move stunned governments around the world, as intelligence documents and diplomatic cables were published, mostly in 2010.

Pte Manning's lawyers were working on a plea deal involving less serious charges that would result in a prison term of at least 16 years, one of his attorneys said.

His captors initially gave him little or no information about the charges against him as he was taken from Iraq to a US detention facility in Kuwait, he said.

Pte Manning said he was confined to a structure he called a "cage" of 2.43m square inside a tent.

He suffered a breakdown about a month after his May 2010 arrest, and guards later found a noose in the cage.

Pte Manning had made the noose but failed to recall he had done so because he was so disoriented, he said.

"I remember thinking I'm going to die stuck here in this cage," Pte Manning said. "I thought I was going to die in that cage. That's what I saw - an animal cage."

Upon being transferred to Quantico, Virginia, in July of 2010, Pte Manning was placed in solitary confinement for up to 23 hours a day, on suicide watch with a guard checking on him every few minutes. He was often noticed playing peek-a-boo in the mirror.

"The most entertaining thing in there was the mirror. I spent quite a lot of time with the mirror," Pte Manning said. When asked why, he said, "Just sheer, complete, out-of-my-mind boredom."

The private's testimony, which was set to continue into today when he would be cross-examined, came on the third day of a hearing at Fort Meade, Maryland, to determine whether his case should proceed to a full court-martial.

In the absence of a plea deal, Pte Manning's case could go to trial, where he faces possible life imprisonment if he is convicted of all the security breach charges against him.

Charges include stealing records belonging to the US and wrongfully causing them to be published on the Internet and aiding enemies of the US, identified by prosecutors as al-Qaeda in the Arabian Peninsula, an affiliate of the militant network founded by Osama bin Laden.

Prosecutors have alleged that Pte Manning, without authorisation while on intelligence duty, disclosed hundreds of thousands of US diplomatic cables, military reports and video of a military helicopter attack in Iraq in which two Reuters journalists were killed.

WikiLeaks has never confirmed Pte Manning was the source of any documents it released.

In pre-trial litigation, prosecutors have presented testimony legal experts say could be used to build a case Pte Manning had been in email contact with Julian Assange, WikiLeaks' Australian-born founder.

Mr Assange has spent nearly six months in the Ecuadorean Embassy in London, where he sought refuge to avoid extradition to Sweden for questioning in a sexual molestation case.

Mr Assange and his supporters have said the Swedish case against him could be part of a secret plot to have him shipped for trial to the US and either executed or imprisoned at the US detention facility in Guantanamo Bay, Cuba.

US officials have denied those assertions. However they have acknowledged a federal grand jury in Alexandria, Virginia, has been collecting evidence about WikiLeaks.

US officials have not ruled out criminal charges against Mr Assange.

Earlier yesterday, Mr Assange played down reports that his health was declining after Ecuadorean officials said he was suffering from a chronic lung ailment.