A view of Virginia Beach Hospital after a shooter opened fire at the Virginia Beach Municipal Center, in Virginia, United States on May 31, 2019.

A man opened fire on co-workers at city offices in Virginia Beach, Virginia, on Friday afternoon, killing 12 people and wounding others before he was fatally shot by police, authorities said.

Virginia Beach Police Chief James Cervera said the mass shooting in the coastal resort city began as a public utility employee entered the public works and utilities building at the city municipal center and "immediately and indiscriminately fired upon all the victims."

The chief later said that the suspect engaged in a "long-term gun battle" with law enforcement officers as police confronted him inside the building. One police officer was wounded in the shootout, but his bullet-proof vest saved his life, Cervera said.

The police chief said the suspect was armed with a .45-caliber handgun equipped with a "sound suppressor" device and was reloading his weapon with extended ammunition magazines as he moved through the building.

Authorities said the gunman ultimately was shot by police and was pronounced dead at a hospital.

Cervera said the suspect was a longtime public utilities employee, and described him as "disgruntled," but declined to say more about what may have precipitated the attack.