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

A New York City police detective was shot and killed Tuesday in what officials said was "friendly fire" while responding to an attempted armed robbery. A second detective who was shot and wounded in the leg was listed as stable.

The fatally wounded detective was identified as Brian Simonsen, a 19-year veteran of the police department. Simonsen, who was shot in the chest, was pronounced dead at Jamaica Hospital, officials said. He was the first New York officer to have been killed in the line of duty since July 2017.

The wounded detective wasn't identified.

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

A suspect, described as a 27-year-old career criminal, was shot multiple times and was in custody at a hospital; no condition was disclosed, but he was listed as stable, New York Police Commissioner James O'Neill said. An "imitation firearm" was found at the scene, he said.

The detectives were responding to a 911 call about a robbery in progress at a cellphone store in Richmond Hills in Queens at about 6:10 p.m. ET, O'Neill said. Officers responded and fired several rounds, during which Simonsen, 42, was struck, O'Neill said.

"This is an absolute tragedy, the worst outcome any police officer or family of a police officer could ever imagine," he said. But "friendly fire aside, it is because of the actions of the suspect that Detective Simonsen is dead."

Mayor Bill de Blasio said at a news conference late Tuesday that he had visited with Simonsen's wife.

"It's a very difficult, painful night for our city," he said.

Investigators at the scene of an attempted robbery at a cellphone store in New York on Tuesday. A New York police detective was killed by what authorities described as 'friendly fire.' Kevin Hagen / AP

Sen. Chuck Schumer, D-N.Y., tweeted about the shooting late Tuesday.

"We are forever indebted to the brave NYPD detective who was killed in Queens tonight and the sergeant who was wounded," Schumer said. "May God bless them and their families."