Media playback is unsupported on your device Media caption Those killed leave a void, Virginia Beach manager Dave Hansen said

A Virginia Beach city employee accused of killing 12 people and injuring four others at a municipal building resigned hours before the attack, police say.

DeWayne Craddock, 40, gave his two weeks' notice in an email on Friday morning, just before he allegedly opened fire on his colleagues.

Officials have yet to give a motive, but say the suspect was "in good standing" and was not forced to resign.

The gunman shot indiscriminately before dying in a gun battle with police.

A city official told the Associated Press on Monday the resignation letter had been brief and had not contained any indication of his plans to attack the office building.

"I will tell you, he was not terminated, and he was not in the process of being terminated. So hopefully we're going to put that piece of this to rest," Virginia Beach Police Chief James Cervera said on Sunday, referring to reports that the gunman had attacked the office over his termination.

Chief Cervera said police were further examining his employment status.

But a person close to the city's government told the New York Times on Saturday that the suspect had recently been involved in physical altercations with other employees, and had been told disciplinary action would be taken over a violent incident last week.

Image copyright Reuters Image caption The shooting was at Building 2 in Virginia Beach Municipal Center

The person said he had had no history of behavioural problems.

Officials have identified the 12 victims, 11 of whom were city employees and one a contractor at the municipal centre. Authorities said they would only refer to Craddock by name once, in order to focus attention on the victims.

What is known about the victims?

The municipal workers killed were Laquita Brown; Tara Gallagher; Mary Louise Gayle; Alexander Gusev; Katherine Nixon; Richard Nettleton; Christopher Kelly Rapp; Ryan Keith Cox; Joshua Hardy; Michelle Langer and Robert Williams.

Robert Williams had worked for the authority for 41 years, the news conference was told, while Christopher Rapp had been there for only 11 months.

The contractor was identified as Herbert Snelling.

Image copyright EPA Image caption Clockwise from top left: Richard Nettleton; Ryan Keith Cox; Christopher Kelly Rapp; Katherine Nixon; Tara Welch Gallagher; Laquita Brown; Mary Louise Gayle; Alexander Gusev; Herbert "Bert" Snelling; Joshua Hardy; Michelle "Missy" Langer and Robert "Bobby" Williams

Four people were wounded, including a police officer whose life was saved by his bulletproof vest.

Outside the municipal centre on Monday, residents visited a makeshift memorial displaying flowers, stuffed animals and crosses emblazoned with victims' names.

What about the gunman?

Police said Craddock had been employed as an engineer with the city's public utilities department for 15 years.

According to AP, he had served in the military and was described by neighbours as quiet and "rarely smiling".

Some US media had reported that the gunman had recently been fired, or was about to be fired.

But Virginia Beach City Manager Dave Hansen said that he had been "in good standing within his department and there were no issues of discipline ongoing".

Two .45-calibre pistols were recovered at the scene and appeared to have been legally purchased, according to Ashan Benedict, the regional special agent for the Bureau of Alcohol, Tobacco and Firearms.

At least one of the guns was equipped with a sound suppressor.

How did the shooting unfold?

The attack began shortly after 16:00 (20:00 GMT), at Virginia Beach Municipal Center. The area was put into lockdown by police and employees were evacuated.

Media playback is unsupported on your device Media caption Virginia Beach witness: 'We barricaded the door'

One of the victims was shot outside in a car and the rest were found over three floors of the government building.

Four officers entered the building, located the gunman and engaged him, police said. The attacker was then shot dead.

According to US tracking website Gun Violence Archive, the incident is the 150th mass shooting in the US so far in 2019 - and the deadliest.

The site defines a mass shooting as a gun attack in which at least four people are either killed or wounded.

It is the worst such shooting in the US since November 2018, when 12 people were killed at a bar and grill near Los Angeles, California.