Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A man whose attempt to rob a New York cellphone store with an imitation gun was charged with murder after a police detective responding to the scene was shot and killed by a fellow officer, police said Wednesday night.

The man, identified as Christopher Ransom, 27, faces charges of second-degree murder and second-degree aggravated manslaughter in connection with the fatal shooting on Tuesday of New York police Det. Brian Simonsen, a 19-year veteran of the police department.

Police Commissioner James O'Neill acknowledged late Tuesday that Ransom was armed with an imitation pistol and didn't shoot Simonsen, but he told reporters: "It is because of the actions of the suspect that Detective Simonsen is dead."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Christopher Ransom, 27, is charged with second-degree murder after a New York police detective was shot and killed by a fellow officer during an attempted robbery on Tuesday. NYPD

Ransom was also charged with two counts of robbery and single counts of assault and menacing. No attorney who could comment was immediately identified.

Kevin Maloney, deputy chief of the police department's Force Investigation Division, said Wednesday that Simonsen and Sgt. Matthew Gorman had been working on an unrelated case nearby when they responded to the cellphone store in the borough of Queens at 6:12 p.m. on Tuesday. Six uniformed officers also responded, he said.

Seven of the eight officers fired 42 rounds, one of which struck Simonsen, Police Chief Terence Monahan said Wednesday. He said it still hadn't been determined which of Simonsen's colleagues fired the shot that killed him.

Gorman was shot in the leg. He remained in a hospital on Wednesday; his condition wasn't reported.

"I can tell you, he's not the least bit concerned about his own injury," Monahan said. "He's overcome by the emotion of losing his friend and his partner."

Maloney said Simonsen was in plainclothes and wasn't wearing protective vests. Following department policy, the uniformed officers were in vests, he said.

Ransom was shot multiple times and remained in the hospital, where he was listed as stable. His condition wasn't released.