Several months before he started providing highly classified data to WikiLeaks, Army Pfc. Bradley Manning erupted violently against one of his superiors in Iraq, pounding his fists, flipping a table with government computers, and trying to grab a firearm from a weapons rack until he was forcibly restrained, an Army officer testified Tuesday.

The late-night outburst inside a secret Army intelligence compound southeast of Baghdad in December 2009 came as the short, scrawny intelligence analyst was growing increasingly distressed about what he was learning about the wars in Iraq and Afghanistan. Soon afterward, while on leave in Washington for the Christmas holidays, he decided to begin leaking hundreds of thousands of classified war logs, diplomatic cables and enemy combatant assessments to the anti-secrecy website.

Defense lawyers say the incident is crucial to their effort to persuade a military judge not to impose the maximum 90-year sentence on Manning, who was convicted in a court-martial of espionage and other charges for the illegal disclosures. They are trying to show that the Oklahoma-born soldier was nearing an emotional breakdown over what he viewed as military atrocities and government lies in the two conflicts.

Manning’s lawyers also contend the incident proves military commanders knew he was mentally unstable but did not remove him from Iraq or dismiss him from the Army.

Manning’s misconduct in Iraq was mentioned during his court-martial. But Chief Warrant Officer Joshua Ehresman, who took the witness stand Tuesday morning, provided more details about the late-night outburst. Ehresman said another supervisor was counseling Manning about his behavior problems.

“Pfc. Manning got a little upset and he dumped a table over,” Ehresman said. “He got angry and slammed his fists on the table. He grabbed onto the table and put his arm under it and flipped it onto the floor. A desktop computer and a laptop came crashing down.

“I went and detained him,” Ehresman continued. “I felt that he was going toward a weapons rack and I felt I needed to detain him. He was visually distraught and had already dumped a table filled with government computers. I grabbed him and put him in a full Nelson and put him on a bench. Then me and him talked. I told him to relax, relax, that we could talk like adults. He said he was calm and to let him go. And he calmed down.”€

In other testimony, Manning’s former supervisor, retired Sgt. 1st Class Paul Adkins, said in April 2010 Manning emailed him a picture of himself in a blonde wig and lipstick attached to a letter titled, “My problem,” which defense attorneys have characterized as a sign of the soldier’s gender-identity crisis at a time when homosexual soldiers couldn’t serve openly.

The email started: “This is my problem. I’ve had signs of it for a very long time. It’s caused problems within my family. I thought a career in the military would get rid of it. It’s not something I seek out for attention. And I’m trying very, very hard to get rid of it by placing myself in situations where it would be impossible. But it’s not going away.”

Adkins, the noncommissioned officer primarily responsible for discipline in the workplace, testified Manning’s mental instability was “a constant source of concern.” But instead of recommending suspension of Manning’s security clearance, Adkins urged psychiatrists to give him more treatment so he could keep him working.

Adkins didn’t’ reveal the email to his commanders until June 2010, after Manning had punched a female soldier in the face, got banned from the workplace and was arrested for leaking classified information.