Motorists stop at the entrance to the Bernie Main Gate of Fort Hood, Texas, Wednesday, April 2, 2014, after a shooting occurred on the military base. / Catrina Rawson AP

by Yamiche Alcindor, USA TODAY

by Yamiche Alcindor, USA TODAY

The man behind Wednesday's deadly shooting at Fort Hood had mental health issues and was being treated for depression and anxiety before he killed three people and wounded 16 others.

Hours after the shooter opened fire, U.S. Rep. Michael McCaul of Texas identified the suspected gunman as Spc. Ivan Lopez. However, officials did not say what might have motivated him to kill fellow soldiers and then himself.

Army officials have not confirmed the shooter's identity.

"We do know that this soldier had behavioral health and mental health issues and was being treated for that," said Lt. Gen. Mark Milley, head of the Army's III Corps at the Texas post.

Lopez was being evaluated for post-traumatic stress disorder (PTSD), but had not yet been diagnosed for the illness.

Lopez, who was on medication, served four months in Iraq in 2011 and had "self-diagnosed" a traumatic brain injury. "He was not wounded in action, to our records," Milley said.

McHugh says the soldier was examined by a psychiatrist last month and was found to show no violent or suicidal tendencies. He says the soldier had been prescribed Ambien to deal with a sleeping problem.Army Secretary John McHugh, the U.S. Army's top civilian official, said the soldier did not see combat during his deployment. The shooter also appeared to have no connections to extremist groups, McHugh said.

Lopez enlisted in the Army in June 2008 as an infantryman and later switched his specialty to truck driver, the job he had in Iraq.

NBC News talked to Lopez's wife at an apartment believed to be the couple's residence in Killeen,Texas Thursday morning.

Morris explained to KXAS-TV that when Lopez's name was announced on TV news reports, his wife came out of her apartment hysterical. Morris said she comforted her until authorities arrived a short time later and escorted her away. The couple's daughter apparently left with relatives, Morris said.

In addition to being examined for signs of PTSD, Lopez was undergoing treatment for depression, anxiety and a "variety" of other issues, Milley said.

Lopez arrived at the installation in February from another Army post and had not been assigned to one of the Army Wounded Transition Units, military units that are set up to care for wounded, injured or ill soldiers. Those assigned to these units have case managers who help them track appointments and manage their medical treatments.

Investigators are checking into whether Lopez had a criminal history, trying to learn more about the state of his mental health and his experiences in combat. There was no evidence that the shooting was terrorism related but nothing is being ruled out, Milley said.

"All the things that you would expect us to be doing are being done right now," he added late Wednesday.

Milley said the shooter, who was armed with a .45-caliber Smith & Wesson handgun, walked into a building on the base and opened fire, then got into a car, fired more shots and then went to another building shooting before he was engaged by responding military police.

All those wounded and killed were military personnel.

A female soldier encountered the shooter in a parking lot, Milley said.

Lopez, dressed in combat fatigues, reached to pull out his weapon from under his jacket. The female soldier then pulled out her gun and "engaged" from about 20 feet away. Lopez then put the gun to his head and fired.

Lopez was assigned to the 13th Sustainment Command (Expeditionary).

Fort Hood was the post where 13 died and more than 30 were wounded in the deadliest domestic military attack in U.S. history.

Army psychiatrist Nidal Hasan was convicted and sentenced to death last year in the Nov. 5, 2009, attack there on his fellow soldiers as they waited inside a crowded building.