DANVERS, Mass. (AP) — The Essex District Attorney says a Danvers man died after being shot by police at a Danvers apartment complex.

District Attorney Jonathan Blodgett identified the man on Friday as 37-year-old Scott Kehoe.

Blodgett said five Danvers police officers and a state trooper were investigating an alleged assault Thursday night and trying to serve existing warrants on him when Kehoe approached them with a knife. The district attorney said Kehoe refused to drop the knife and was shot when he lunged toward one of the officers. He was pronounced dead at a hospital.

Danvers Police Chief Neil Ouellette said the shooting occurred as the man was being taken into custody. The chief said the alleged assault was related to a robbery and wasn't "a random event."

Blodgett said his office will review the shooting, as is standard procedure.