A municipal employee sprayed gunfire "indiscriminately" in a government building complex on Friday in the US state of Virginia, police said, killing 12 people and wounding four in the latest mass shooting to rock the country.
The shooter was also killed after an extended gun battle with responding officers, in a scene that "best could be described as a war zone", Virginia Beach police chief James Cervera said.
The shooting happened just after 4pm, when the gunman entered one of the buildings at the Virginia Beach municipal complex and "immediately began to indiscriminately fire on all of the victims", Mr Cervera said.
One victim was killed outside in his vehicle, while the others were found on all three floors of the building. Police raised the casualty toll to 12 dead and four wounded on Friday night, after earlier reporting 11 dead and six wounded.
Authorities did not immediately name the attacker but sources quoted by CNN identified him as DeWayne Craddock, a 40-year-old civil engineer who worked in the municipality's public utilities department.
Mr Cervera said the shooter was armed with a .45-calibre handgun fitted with a sound suppressor, and he reloaded several times with extended magazines. Officers were able to locate him from the sound of gunfire and "immediately engaged with the suspect", he said, adding "I can tell you that it was a long gun battle".
The wounded included a police officer, who was saved by his bulletproof vest. All were undergoing surgery on Friday night.
The building where the shooting took place in Virginia Beach – a city of 450,000 people about 320 kilometres south-east of Washington – housed the city's public works and utilities offices and could have as many as 400 people inside at any time.
"This is the most devastating day in the history of Virginia Beach," Mayor Bobby Dyer told reporters. "The people involved are our friends, co-workers, neighbors and colleagues."
Megan Banton, a public utilities employee, told local television station WVEC that during the chaos she and about 20 co-workers hid in an office, where they used a desk to wedge the door shut.
"We just wanted to try to keep everybody safe as much as we could and just trying to stay on the phone with 911, just because we wanted to make sure [police] were coming. They couldn't come fast enough," she said, adding that it felt like "hours".
"We heard gunshots. We kept hearing gunshots and we kept hearing the cops saying, 'Get down.'"
Ms Banton said it felt "surreal" to have a mass shooting in her office building, and having survived it she just wanted to go home and hug her family.
"I have an 11-month-old baby at home and all I could think about was him and trying to make it home to him," she said.
President Donald Trump had been briefed on the shooting and was monitoring the situation, the White House said.
According to the Washington-based Gun Violence Archive monitoring group, Friday's shooting was the 150th mass shooting in the United States this year, defined as a single event in which four or more people are shot or killed.
Despite the scale of gun violence across the nation, gun ownership laws are lax and efforts to address the issue legislatively have long been deadlocked at the federal level.
Among Democrats, the response to the shooting was especially pointed, with many of the party's White House hopefuls weighing in on the gun violence crisis.
"Another horrific shooting shocks the nation, this time in Virginia Beach," Pete Buttigieg tweeted. "Already, this much is clear: it is unacceptable for America to remain the only developed country where this is routine. We must act."
Senator Bernie Sanders decried the influence of the National Rifle Association, a powerful lobby group that routinely calls for more guns in US society so that ordinary citizens are armed and ready to confront a "bad guy".
"The days of the NRA controlling Congress and writing our gun laws must end. Congress must listen to the American people and pass gun safety legislation. This sickening gun violence must stop," he said in a tweet.
Virginia Governor Ralph Northam said it was a "horrific day" for the state.
"Our hearts ache over the senseless violence that has been inflicted upon the Virginia Beach community today. My deepest condolences and prayers go to the families of those who left home this morning and will not return tonight," he said.
Singer and music producer Pharrell Williams, a native of Virginia Beach, paid homage to the strength of his hometown.
"We are praying for our city, the lives that were lost, their families and everyone affected. We are resilient," he said in a tweet.
"We will not only get through this but we'll come out of this stronger than before we always do."