VIRGINIA BEACH, Va. (AP) — The gunman who attacked his colleagues at a Virginia Beach government office building resigned by email hours before the shooting, a city official said Sunday as authorities sought a motive in the assault that killed 12 people.

Officials gave no indication why 40-year-old DeWayne Craddock had notified a superior of his intention to leave his job as a civil engineer in the utilities department. He was an employee "in good standing" and showed "satisfactory" job performance, City Manager Dave Hansen said.

Police Chief James Cervera described a chaotic scene as officers entered the building and pursued the assailant through a tightly packed warren of offices that the chief likened to a maze or a honeycomb. They exchanged fire in a protracted gunbattle. Cervera did not know how many rounds were fired but said it was "well into the double digits."

"In the police world, anything more than three to five shots is a long gunbattle," he said.

At one point, the suspect fired at officers through a door and a wall and hit one officer, who was saved by a bulletproof vest. Then the firing stopped, and police realized the gunman was holed up in an office.

When they got into the office, they took the wounded shooter into custody and gave him first aid, Cervera said. He was taken from the scene by ambulance 36 minutes after officers arrived and died at a hospital. A medical examiner will determine whether he was killed by an officer's bullet or his own, the chief said.

There was no indication he targeted anyone specifically. Cervera said investigators are retracing the gunman's activities on the day of the attack, using his electronic keycard to track his movements through secure areas of the building. They are also reviewing his personal and professional lives trying to find a motive.

"Right now we do not have anything glaring," he said. "There's nothing that hits you right between the eyes. But we are working on it."

Craddock appeared to have had no felony record, making him eligible to purchase guns. Government investigators identified two .45-caliber pistols used in the attack, and all indicators were that he purchased them legally in 2016 and 2018, said Ashan Benedict, the regional special agent for the Bureau of Alcohol, Tobacco and Firearms. The police chief said at least one had a noise suppressor.

City officials uttered the gunman's name just once and said they would not mention it again.

Officers found victims throughout the building, on three floors. Among the dead were four other engineers who worked to maintain streets and protect wetlands and three right-of-way agents who reviewed property lines. Others included an account clerk, a technician, an administrative assistant and a special projects coordinator. In all, they had served the city of Virginia Beach for more than 150 years.

The 12th fatality was a contractor who was in the building seeking a permit.

At least four other people who were wounded remained hospitalized in critical condition Sunday.

A handwritten note was posted Saturday at the suspect's home expressing condolences to the shooting victims on behalf of his family. Co-workers described him as quiet, nice and polite, and neighbors said he was into cars and bodybuilding.

Two city workers said Sunday that they are lucky to be alive after coming face-to-face with the gunman during his rampage.

Terry Inman, an account clerk in the city's public utilities department, said he turned around and saw Craddock standing there with a gun. Inman said he told him, "DeWayne, stop!"

"He turned and looked straight at me, but he didn't see me. He looked straight in my face, and he did not see me standing there because he didn't raise the gun. He didn't even make an indication that he saw anyone there," Inman told The Associated Press. "To me, that was the Holy Spirit inflecting something on that man to the point where he didn't see Terry Inman standing there."

Inman's colleague, Ned Carlstrom, crossed paths with the gunman three times and made eye contact twice. He can only guess that Craddock spared him because they parked near each other and often had lighthearted conversations during the morning walk to the building.

"He had the gun down at his side. He was so close to me. He swung his arm out. He damn near hit me with the gun. That's how close we were," Carlstrom said. "But he never raised the gun at me. He looked up at me briefly."

Inman said he did not know of any turmoil in Craddock's life.

"It's so cotton-picking cliche you almost hate to say it, but he has always been rock-solid kind of positive guy. He always had a smile on his face," Inman said. "Nothing in (his) character would cause you to think, 'This guy is going to come in and kill 11 of my colleagues ... 12 people that work in the same building.'"

___

Kunzelman reported form Chesapeake, Virginia. Associated Press writers Regina Garcia Cano, Michael Biesecker, Michael Balsamo and Eric Tucker in Washington, D.C., also contributed to this report.

Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.