COLUMBIA, S.C. (AP) – A Greenville County man shot and killed after he fired a shot at officers who kicked down his apartment door was the victim of an armed robbery a few minutes earlier, authorities said Thursday.

Deputies charged a man with robbing 55-year-old Charles Edward Rosemond Sr., holding him at gunpoint and firing a shot in his apartment in Taylors on Dec. 10, according to arrest warrants.

That shot prompted a neighbor to call 911 about 1 a.m., Sheriff Steve Loftis told reporters last week.

Officers arrived and knocked on the door several times, shouting they were police, but getting no answer. They decided to kick down the door in case someone was injured, the sheriff said.

Rosemond fired a shot that hit deputy Dave Dempsey in the head. He survived, but was in critical condition earlier this week and had to have part of his skull removed because his brain was swelling, authorities said.

Rosemond was shot in the leg and died, according to the coroner’s office.

Rosemond’s actions gave the three officers who responded no choice but to fire back, Greenville County Sheriff’s spokeswoman Lt. Ty Miller said.

“What was waiting on the other side of a door was a gunshot that could have killed a deputy,” Miller said. “There was no way to anticipate who was firing the shot.”

The sheriff’s office is not releasing the names of the two deputies who fired after Dempsey was shot or the races of any of the officers. Rosemond was black, the coroner said.

Andre Hunter Jr., 27, faces armed robbery, kidnapping and several other charges. Hunter robbed Rosemond and another unidentified person in the house and lives in the same apartment complex, according to arrest warrants.

Court records did not list a lawyer for Hunter.