A U.S. soldier shot dead three people and injured at least 16 on Wednesday before taking his own life at an Army base in Fort Hood, Texas, the site of another deadly rampage in 2009, U.S. officials said.
The soldier, who was being treated for mental health problems, drove to two buildings on the base and opened fire before he was stopped by military police, in an incident that lasted between 15 and 20 minutes, Fort Hood commanding officer Mark Milley said.
The gunman then shot himself in the head with a .45-caliber pistol, Milley added.
Security officials said preliminary information identified the gunman as Ivan Lopez, and the shooting was not linked to terrorism.
Milley declined to identify the shooter until his family was notified. All the wounded and killed were military personnel.
U.S. President Barack Obama said he was "heartbroken" that another shooting had occurred at the Fort Hood Army base and described the situation there as fluid.
"We are going to get to the bottom of exactly what happened," Obama told reporters in Chicago, where he is traveling for Democratic fundraisers. "We're heartbroken that something like this might have happened again."
The shooting, the third such incident at a military base in the United States in about six months, started at 4:30 p.m. local time (2130 GMT) and put Fort Hood on immediate lockdown.
Police secured its perimeter, emergency vehicles rushed to the scene and helicopters circled the base as officers went from building to building searching for the shooter.
A base announcement told people to lock their windows and doors, while scores of police cars and ambulances arrived at the scene, TV images showed.
"I'm safe. I'm locked down. I'm not allowed to use my cell phone. I'm going to be here a long time, I can tell you that," said one base officer who asked not to be named.
Central Texas College, which has a Fort Hood campus, ordered an immediate evacuation of all students and staff, and canceled classes.
The Scott and White Hospital in Temple, Texas, said it had received four patients, ranging from critical condition to stable with single and multiple gunshot wounds. Two more were arriving soon, hospital officials told a news conference.
"It's a terrible tragedy. We know that. We know there are casualties, both people killed and injured," Defense Secretary Chuck Hagel told a news conference in Honolulu, where he was meeting with Asian defense ministers.
String of recent shootings at bases
The violence echoed the rampage of 2009, when a former Army psychiatrist shot dead 13 people and wounded 32 others in a shooting spree at Fort Hood, a base from where soldiers prepare to deploy to Iraq and Afghanistan.
Major Nidal Hasan shouted "Allahu Akbar," or "God is greatest" in Arabic, during the attack and later said he wanted to be a martyr. He was convicted and faces death by lethal injection.
In February, the U.S. military demolished the building where Hasan went on a shooting spree. It will plant trees, install a gazebo and mark the site with a remembrance plaque for the victims, the base said.
In September, a gunman opened fire at the Washington Navy Yard, killing 12 and wounding four before being slain by police. Last month, a civilian shot dead a sailor aboard a ship at a U.S. Navy base in Norfolk, Virginia.
Hagel, pressed about the military's so-far frustrated effort to secure its bases from potential shooters, said the latest incident at Fort Hood showed that there were problems that still needed to be addressed.
"When we have these kinds of tragedies on our bases, something's not worked. So we'll identify it, we'll get the facts, and we'll fix it," Hagel told reporters, standing on the flight deck of the USS Anchorage, an amphibious ship, in Hawaii.
Just last month, he ordered steps to be improve Pentagon security after reviews found the Navy Yard shooting could have been averted if the gunman's mental health had been properly handled.
He said at the time: "The reviews identified troubling gaps in DoD's (Defense Department's) ability to detect, prevent and respond to instances where someone working for us, a government employee, member of our military, or a contractor, decides to inflict harm on this institution and its people."