Friendly fire was blamed in the death of a New York City police detective who responded to a robbery in Queens after a gun battle erupted Tuesday night that injured another officer and left the suspect in critical condition, police said.

Detective Brian Simonsen, 42, was fatally shot in a T-Mobile store, police told the New York Post. Sergeant Matthew Gorman was also struck by friendly fire in the leg, the paper reported. Police told the Post that both officers were believed to have been struck when other officers arrived at the scene and began shooting.

The suspect, a career criminal, was taken into custody and reported to be in critical condition, according to the Post. He had been wielding an imitation gun.

The incident occurred at a T-Mobile location, according to a Fox 5 NY reporter who tweeted a photo from the scene.

A 911 caller said two employees at the counter of the T-Mobile cell phone store were forced at gunpoint to the back of the store during an attempted robbery, NYPD Commissioner James O'Neill said during an evening news conference.

The officers responded to the scene but did not see anyone inside the store, O’Neil said. The officers entered and found the suspect pointing at them what appeared to be a handgun. As the suspect advanced toward them, the officers fired their weapons and retreated out of the store.

Simonsen was then struck by friendly fire. Police rushed the detective to Jamaica Hospital, where he was pronounced dead, O’Neil said.

“At this hour, this appears to be an absolute tragic case of friendly fire," the commissioner said.

Gorman, a sergeant who has served over eight years with the NYPD, was shot once in the leg. A passerby stopped to help the wounded officer and took him to the hospital. He is in stable condition, according to the commissioner.

The suspect's firearm recovered at the scene was fake, O'Neill said.

The commissioner tweeted that Simonsen was a 19-year veteran of the department. The detective is survived by his wife and mother.

New York Mayor Bill de Blasio tweeted: "We will never forget him or his sacrifice. We will be there for his family and his fellow officers tonight, tomorrow and every day after that."

CLICK TO GET THE FOX NEWS APP

Following word of the shooting, Sen. Chuck Schumer D-N.Y. tweeted: "We are forever indebted to the brave NYPD detective who was killed in Queens tonight and the sergeant who was wounded. May God bless them and their families."

This is a developing story. Please check back for updates.

The Associated Press contributed to this report.