(CNN) The shooter who opened fire indiscriminately in a Virginia Beach city building Friday afternoon, killing 12 people and sending at least four others to the hospital, was a disgruntled employee, a Virginia government source briefed on the investigation told CNN.

The shooter, a public utilities worker, died after a long, moving gunfight with officers, Police Chief James Cervera told reporters.

Four people were in surgery Friday night, the chief said. Hospital officials said three people are in critical condition and one is in fair condition.

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

Cervera said one person was shot in a car and the gunman fired indiscriminately as he went through all three floors of Building 2 at the city's municipal center.

An officer involved in the gunfight was shot. The officer survived, thanks to a ballistic vest, the police chief said.

The shooting suspect was identified as DeWayne Craddock, according to a law enforcement official and a Virginia government source.

Craddock, 40, worked as a certified professional engineer for the city of Virginia Beach in the Public Utilities Department. He is listed on department news releases as a point of contact for information on local road projects over the past several years.

Authorities are investigating a possible motive.

'The guy's got a gun'

Edward Weeden, who works in the building, told CNN affiliate WAVY that people heard someone falling in a stairwell and went to investigate. He and his coworkers saw a woman who was down, blood all over her face.

One of Weeden's coworkers went up to the next floor and came right back. "Get out of the building. The guy's got a gun," the woman said.

Weeden said he was unsure at first how to react.

"In a way you want to stay, in a way you don't want to stay," he said.

Gordon Rago, a reporter at The Virginian-Pilot, said witnesses described the scene as "frantic."

He said the shooting occurred when people were still visiting the municipal center to conduct business.

Witnesses told him that SWAT officers were running down the street, directing them to get inside.

"I've talked to people who said that they were hiding under their desks," Rago said.

Police found a pistol and a rifle at the scene that investigators believe were used in the shooting, according to a law enforcement official.

The suspect is thought to have purchased the firearms legally, according to initial information that investigators have, the source says.

The chief confirmed that a .45 caliber pistol, a supressor and several empty, higher-capacity magazines were found near the gunman but wouldn't comment on the presence of a rifle.

Vice Mayor James Wood said people can take guns into public buildings, but not schools or courts.

The mass shooting took place in Building 2 of the municipal center, according to police.

Building 2 of the Virginia Beach Municipal Center houses the operations building for the city, which include multiple departments.

The FBI is also responding to the incident to aid local authorities, an FBI spokeswoman told CNN. The chief said state police had sent a forensics team.

In that shooting, 12 people were killed at the Borderline Bar & Grill in Thousand Oaks, California. Officials said that gunman, Ian David Long, shot an unarmed security guard outside the bar, went in and continued shooting, injuring other security workers, employees and patrons. Long died by suicide.

Virginia Sen. Tim Kaine tweeted that he was devastated by the news.

"My heart is with everyone who lost a loved one, and I'm praying for a swift recovery for all those who have been injured," he said.

Sen. Mark Warner wrote: "Praying for all involved as we learn more."

"We are praying for our city, the lives that were lost, their families and everyone affected," singer Pharrell Williams, who grew up in Virginia Beach, tweeted. "We are resilient. We will not only get through this but we'll come out of this stronger than before we always do."

President Trump has been briefed on the shooting, White House spokesman Hogan Gidley said.