A US soldier being treated for mental health problems shot dead three people and injured at least 16 more at an Army base in Fort Hood, Texas, that was the site of another deadly rampage in 2009.
The soldier 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.
Security officials said preliminary information identified the gunman as Ivan Lopez, and the shooting was not linked to terrorism.
All the wounded and killed were military personnel.
US 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 travelling 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.30pm local time (9.30am NZ time) 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.
Meanwhile, relatives of soldiers waited for news about their loved ones.
Tayra DeHart, 33, said she had last heard from her husband, a soldier at the post, that he was safe, but that was hours earlier.
''The last two hours have been the most nerve-racking I've ever felt. I know God is here protecting me and all the soldiers, but I have my phone in my hand just hoping it will ring and it will be my husband,'' DeHart said.
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," Defence Secretary Chuck Hagel told a news conference in Honolulu, where he was meeting with Asian defense ministers.
STRING OF 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 US 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 US 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 (Defence 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."