Local and military police direct traffic outside Fort Hood military installation on Wednesday. (Ashley Landis/EPA)

The gunman who opened fire at Fort Hood on Wednesday, killing three people and injuring 16 others before taking his own life, “had a clean record” before the shooting, Secretary of the Army John M. McHugh said Thursday morning during a Senate hearing.

McHugh and Raymond Odierno, the Army chief of staff, were already scheduled to testify before the Senate Armed Services committee on the Army’s current posture. But as both men acknowledged at the beginning of the hearing, it was being held under the shadow of Wednesday’s shooting.

Army Spec. Ivan Lopez, 34, has been identified by officials as the gunman.

“He was undergoing a variety of treatment and diagnoses for mental health conditions ranging from depression to anxiety to some sleep disturbance,” McHugh said.

As part of that, Lopez was examined by a psychiatrist just last month. There were no indications in that examination “that there was any sign of likely violence to himself or others,” McHugh said.

“He had a clean record…no outstanding bad marks for any kind of major misbehavior we are as yet aware of,” he added.

Background checks on Lopez have not shown involvement with any extremist organizations, McHugh said, though he added that the situation is fluid and that the investigation is in its early stages.  “Possible extremist involvement is still being looked at very, very carefully,” McHugh said.

The shooter had served two deployments, including one in Iraq from August to December 2011, but did not have direct involvement in combat, McHugh said.

Lopez, who was married, did not live in the Fort Hood installation. He had a .45-caliber Smith & Wesson semiautomatic pistol that he bought recently, authorities said, which he was not required to register with Fort Hood but was also not allowed to bring onto the installation.

Odierno said that procedures put into place after the 2009 shooting at Fort Hood helped the response on Wednesday, saying that the latest shooting was “something that could have been much, much worse.”

Fort Hood is a “place that suffered so much pain, so much anguish” less than five years ago, which only adds to the shooting’s tragedy, McHugh said. “Our actions and our every effort will be with those families, those survivors, whatever the struggle,” he said.

You can read a transcript of the hearing here.