Three officers fatally shot a Lynn man when he pointed a gun at them as they attempted to arrest him for a robbery last week at a local tavern, authorities said Tuesday.

Lynn Police were attempting to serve a search warrant just after 9 a.m. Monday for a 57-year-old resident who was the suspect in a Sept. 26 armed robbery at Lynn's Porthole Pub when the shooting took place, authorities said.

When officers knocked and announced themselves at the door, the suspect replied that "police were not going to take him," police and a witness inside the apartment said.

The witness also said that the suspect was pointing a gun at the door. She then retreated into her bedroom. Officers forced their way into the apartment and saw the suspect pointing a gun at the door.

The suspect left the apartment and went into the hallway, continuing to point the gun at officers, at which point three officers fired at him, according to the Essex District Attorney's Office.

Investigators are working to determine how many shots were fired and how many shots hit the suspect, who was identified Tuesday as Robert Dapkus.

Lynn Police immediately called for an ambulance after opening fire. The fire department responded and pronounced Dapkus dead at the scene. 

The Essex District Attorney’s Office, along with state police detectives assigned to the office, are investigating the shooting. The names of the police officers involved are expected to be released after the investigators complete their interviews later this week.