A longtime public utilities employee opened fire on co-workers at a municipal center in Virginia Beach on Friday, killing 12 people and wounding at least four others before police fatally shot him in a heated gun battle.

Virginia Beach police Chief Jim Cervera said the heavily armed shooter died in an exchange of gunfire with four officers who rushed into the building. The gunman was armed with a .45 caliber handgun and he exhausted multiple extended magazines in the onslaught, leaving a "war zone" of carnage, spent bullets and empty ammunition casings, Cervera said.

Cervera said the gunman walked into the Virginia Beach Municipal Center - where up to 400 people work - shortly after 4 p.m. EDT and "immediately began to indiscriminately fire upon all the victims." His name has not yet been released because police said they have been unable to notify his relatives.

"The officers stopped this individual from committing more carnage," Cervera said. The gunman likely would have used all his ammunition on innocent people had the officers not engaged him in the gun battle, forcing him to use up the massive store of ammunition that he brought on his killing mission, the chief said.

Among the wounded: a Virginia Beach Police officer whose life was saved by his bulletproof vest, Cervera said.

Police also say the gunman brought extended ammunition magazines that held more bullets than a typical magazine, suggesting that he wanted as much firepower as possible to inflict damage inside the building.

He also had a sound suppressor for his handgun. Unlike some states, silencers are legal in Virginia, though it is illegal to have one in Virginia Beach per local ordinance.

More:What we know so far about the Virginia Beach shooting

The nation's latest mass shooting sent alarm and shock throughout Virginia Beach, a popular resort town with a population of 440,000. The municipal center is several miles from the resort areas of the beach, located along the Atlantic Coast about 200 miles south of Washington, D.C. The community is also home to three military bases.

"This is the most devastating day in the history of Virginia Beach," Mayor Bobby Dyer said. "The people involved are our friends, coworkers, neighbors and colleagues."

The extent of the injuries to survivors is still unclear. Four patients were undergoing surgery late Friday at Sentara Virginia Beach General Hospital. Initially, police said 11 victims had died, but a 12th died on their way to the hospital.

"We're still trying to figure it out," Dyer said of the victims and their injuries. "There is obviously a lot of chaos and confusion."

The gunman himself was among the wounded after the gun battle. Officers were in the midst of bringing him out of the building when he died of his wounds, Cervera said.

Christina Pullen, a spokeswoman for the FBI in Norfolk, said the bureau is responding to assist Virginia Beach police.

The shooting broke out in Building No., 2 of the sprawling Virginia Beach Municipal Center, which includes several city facilities, including the police department. Building 2 houses offices for planning and public works and is adjacent to city hall.

Megan Banton, an administrative assistant who works in the building where the shooting broke out, said she heard gunshots, called 911 and barricaded a door.

“We tried to do everything we could to keep everybody safe,” she said. “We were all just terrified. It felt like it wasn’t real, like we were in a dream. You are just terrified because all you can hear is the gunshots.”

Sheila Cook, an employee, said workers heard shooting but didn't think it was so close. She told reporters that police were able to alert them quickly to give them time to leave the building.

"I am still shaken, because there is entirely too much killing going on," Cook said.

Zand Bakhtiari told The Virginian-Pilot newspaper that the gunfire thundered in swift succession, sounding like an automatic weapon. “It was repeated, rapid gunfire,” said Bakhtiari, who said he was one of only five people left in the IT department on the first floor of the building at the end of the day. He was warned by his supervisor, who had left the office and texted to say there was an active shooter and people should shelter in place.

After a few minutes the flurry of bullets seemed to stop, he said, but the fire alarm went off and he could smell gunpowder. After about 10 minutes SWAT team members and police escorted Bakhatiari and his co-workers to safety, he told the paper.

Arthur Felton, an 18-year employee in the planning department, told the Virginian-Pilot he was able to evacuate after a co-worker heard gunshots. A shaken Felton said he “never thought this would happen in my building. The people who were shot – I’m sure I know most of them.”

City Councilwoman Barbara Henley had just arrived at the City Hall building right after 4 p.m. when she heard sirens and assumed there had been an accident, she told the Virginian-Pilot.

After exiting her car, Henley said she was told by employees outside there was a shooting as they urged her to leave. She said she heard someone shout “Get down!” as she got back in her car. “I was scared to death.”

Henley told the paper security had been increased recently at the City Hall building but said some other city buildings don’t follow the same security measures.

Survivors of the shooting were reuniting Friday evening with friends and relatives at a middle school.

Paul Swain was among those who arrived at the Princess Anne Middle School to reunite with loved ones who were in the municipal building during the shooting. Swain said he saw his fiancee across the parking lot, clearly in an agitated state. He said he thinks she knew some of the people who were hurt or killed.

The school’s parking lot was filled with police and civilian vehicles.

Cervera praised first responders for their actions. "When this violent act occurred, police and fire-rescue responded and did the professional thing that they do, because that's what they do," he said.

Cervera also said that citizens can "rest easy" tonight after the suspect was taken down.

"This day will not define Virginia Beach, our response will define Virginia Beach," Councilman Aaron Rouse said. "We will come together, we will show the strength of our city."

Virginia Gov. Ralph Northam, who rushed to the scene, said it was an "horrific day" for the community and that "This is unspeakable, senseless violence."

The mayor of Aurora, Illinois, where six people were killed in a shooting in February, said people in his community "mourn for the victims of this senseless mass shooting."

Virginia Beach Council member Aaron Rouse was a student at Virginia Tech when 33 people died in a mass shooting at the Blacksburg school in 2007. He told CNN he was “in shock” when he learned of Friday’s rampage, and it hit close to home. “I immediately jumped into ‘not again, this cannot happen again, I can’t believe this happened again.’”

Rouse, who saluted the valiant first responders on Friday, said he went from feeling sorry and helpless during college to knowing that in his role as a councilman he could help have “those tough conversations” about ways to end gun violence and make communities safer. “We must learn from the mistakes of our past. We cannot show fear; our leaders have to stand up.”

Rouse said a good way to start was to open minds and hearts and have more tolerance for people. Mass shootings affect everyone, no matter where they happen, he told CNN. “We were Virginia Tech strong, now we are Virginia Beach strong.”

Contributing: Susan Miller and the Associated Press