KILLEEN, Tex. — A soldier who was being evaluated for post-traumatic stress disorder opened fire at Fort Hood on Wednesday, killing three people and wounding 16 before killing himself, the authorities said. The shooting set off a huge police response and shut down the sprawling Army base, the same facility where a deadly rampage by an officer resulted in 13 deaths in 2009.

Fort Hood’s commanding general said the gunman, an Army specialist who had served in Iraq and was being treated for behavioral and mental health issues, had died of a self-inflicted gunshot wound. The commander, Lt. Gen. Mark A. Milley, told reporters that the soldier’s motive remained unclear, but that the shooting did not appear to be related to terrorism.

A Pentagon official said the suspected gunman was Army Specialist Ivan Lopez. General Milley, while not identifying Specialist Lopez by name, said the gunman had served four months in Iraq in 2011 and was being evaluated for post-traumatic stress disorder, but had not yet been diagnosed with the condition. There were indications that he had self-reported a traumatic brain injury when he returned from Iraq, General Milley said.