Army Pfc. Bradley Manning is escorted out of a courthouse in Fort Meade, Md., in this file photo from June 25, 2012. Manning is expected to testify in court for the first time as early as Wednesday. (Patrick Semansky/AP)

The Army private accused of leaking hundreds of thousands of military and diplomatic documents to the anti-secrecy group WikiLeaks is expected to testify in court for the first time as early as Wednesday, part of an attempt by his attorney to convince a judge that his earlier pre-trial confinement was unlawful.

Supporters of Pfc. Bradley Manning, 24, have alleged that he was mistreated while held in the brig at Marine Corps Base Quantico, where he was kept in solitary confinement for more than eight months beginning in August 2010.

Manning faces 22 charges, ranging from the use of unauthorized software on a classified computer to aiding the enemy. If convicted on all counts, he could be sentenced to life in prison.

Manning’s attorney, David Coombs, has filed a motion asking the judge to dismiss the charges against him or reduce any sentence that is rendered because of the alleged mistreatment.

During his solitary confinement, Manning was stripped of his clothes and not allowed bed sheets or a pillow, and was kept in his cell for 23 hours a day. Military officials have said they imposed the strictest conditions on the soldier because they considered him a suicide risk.

Coombs argues that although his client was deemed a suicide risk when he arrived at Quantico in July 2010, officials there recommended he be taken off “prevention-of-injury” status and out of maximum custody two months later. Despite those recommendations, Manning was held in solitary confinement until April, 2011.

The proceedings at Fort Meade began Tuesday and are expected to last several days. It is unclear exactly when Manning will testify.

Retired Col. Daniel Choike, the garrison commander of Quantico Marine Corps Base at the time of Manning’s confinement, told a packed courtroom Tuesday that psychiatrists who treated and observed Manning had written multiple reports asserting that he was not a threat to himself. He said, however, that Manning appeared to be emotionally unstable, at times playing peek-a-boo with guards, dancing erratically and licking the bars of his cell.

Coombs argued that Manning was courteous and respectful to guards in the brig and had not been disciplined while in detention. He said guards had wrongly interpreted a joke Manning had made about using his clothes to take his own life, saying “The waistband of the underwear can do this, or my flip flops.”

When asked why Manning was not removed from the unit, Choike insisted that given the seriousness of the charges and Manning’s emotional history — he had been put on suicide watch while held in Kuwait before transfer to Quantico — his confinement was appropriate.

Manning has since been moved to Fort Leavenworth, Kan.

In February, an Army general ordered a court-martial for Manning after a preliminary hearing in which the prosecution presented evidence that Manning had given WikiLeaks hundreds of thousands of State Department cables, daily field reports from the wars in Iraq and Afghanistan and other classified material.