Updated

An Iraq War veteran being treated for mental illness opened fire Wednesday on fellow service members at the Fort Hood military base, killing three people and wounding 16 before committing suicide at the same post where more than a dozen people were slain in a 2009 attack, authorities said.

Ivan Lopez apparently walked into a building and began firing a .45-caliber semi-automatic pistol. He then got into a vehicle and continued firing before entering another building.

Lopez was eventually confronted by military police in a parking lot. As he came within 20 feet of an officer, the gunman put his hands up but then reached under his jacket and pulled out his gun. The officer drew her own weapon, and the suspect put his gun to his head and pulled the trigger a final time, according to Lt. Gen. Mark A. Milley, senior officer on the base.

The gunman, who served in Iraq for four months in 2011, had sought help for depression, anxiety and other problems. Before the attack, Lopez had been undergoing an assessment to determine whether he had post-traumatic stress disorder, Milley said.

"We do not know a motive," Milley added. "We do know that this soldier had behavioral health and mental health issues, and was being treated for that."

The married suspect had arrived at Fort Hood in February from another base in Texas. He was taking medication, and there were reports that he had complained after returning from Iraq about suffering a traumatic brain injury, Milley said. The commander did not elaborate.

Lopez was not wounded in action while serving overseas, but self-reported a traumatic brain injury upon his return to the U.S. "He was not a wounded warrior," said Lt. Gen. Mark Milley, the senior officer at Fort Hood. "He was not wounded in action, to our records, no Purple Heart, not wounded in action in that regard."

There was no indication the attack was related to terrorism, Milley said.

The military declined to identify the gunman until his family members had been notified.

The weapon had been purchased recently in the local area and was not registered to be on the base, Milley said.

Late Wednesday, investigators had already started looking into whether Lopez's combat experience caused lingering psychological trauma. Among the possibilities they planned to explore was whether a fight or argument on the base triggered the attack.

"We have to find all those witnesses, the witnesses to every one of those shootings, and find out what his actions were, and what was said to the victims," said a federal law enforcement official, speaking on condition of anonymity because he was not authorized to discuss the case by name.

The official said authorities would begin by speaking with Lopez's wife and expected to search his home and any computers he owned.

The injured were taken to the base hospital and other local hospitals. At least three of the nine patients at Scott and White Hospital in Temple were listed in critical condition.

The 2009 assault on Fort Hood was the deadliest attack on a domestic military installation in U.S. history. Thirteen people were killed and more than 30 wounded. Army psychiatrist Nidal Hasan was convicted and sentenced to death last year in that mass shooting. He said he acted to protect Islamic insurgents abroad from American aggression.

After that shooting, the military tightened security at bases nationwide. Those measures included issuing security personnel long-barreled weapons, adding an insider-attack scenario to their training and strengthening ties to local law enforcement. The military also joined an FBI intelligence-sharing program aimed at identifying terror threats.

In September, a former Navy man opened fire at the Washington Navy Yard, leaving 13 people dead, including the gunman. After that shooting, Defense Secretary Chuck Hagel ordered the Pentagon to review security at all U.S. defense installations worldwide and examine the granting of security clearances that allow access to them.

At Ford Hood on Wednesday, relatives of soldiers waited anxiously for news about their loved ones.

"The last two hours have been the most nerve-wracking I've ever felt," said Tayra DeHart, 33, who had earlier heard from her husband that he was safe but was waiting to hear from him again.

Brooke Conover, whose husband was on base at the time of the shooting, said she found out about it while checking Facebook. She immediately called her husband, Staff Sgt. Sean Conover.

"I just want him to come home," Conover said.

President Barack Obama vowed that investigators would get to the bottom of the shooting.

In a hastily arranged statement in Chicago, Obama reflected on the sacrifices that troops stationed at Fort Hood have made — including enduring multiple tours to Iraq and Afghanistan.

"They serve with valor. They serve with distinction, and when they're at their home base, they need to feel safe," Obama said. "We don't yet know what happened tonight, but obviously that sense of safety has been broken once again."

The president spoke in the same room of a steakhouse where he had just met with about 25 donors at a previously scheduled fundraiser for the Democratic National Committee.

Based on reporting by The Associated Press.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino