NEW YORK -- A robbery suspect with a long rap sheet and a habit of bizarre stunts was charged Wednesday with murder in the death of a New York City police detective struck by friendly fire while responding to a stick-up Tuesday night.

Detective Brian Simonsen died after being hit once in the chest by crossfire as he and six other officers fired 42 shots at suspect Christopher Ransom, who charged toward the entrance of a Queens store and mimicked pulling the trigger of a fake handgun, police said.

"You have to understand, this happens in seconds," Chief of Department Terence Monahan said. "It goes from 0 to 60. You're investigating a possible crime and all of a sudden someone is charging at you, pointing what you believe to be a firearm, simulating firing at you. It raises everything very quickly."

Simonsen's supervisor, Sgt. Matthew Gorman, and Ransom were also wounded. Gorman was hit in the leg. The extent of Ransom's injuries is unclear. Both are listed in stable condition.

Ransom, 27, is also charged with robbery, assault, aggravated manslaughter and menacing. It wasn't clear if he had a lawyer who could comment on his behalf. A telephone number listed for Ransom in Brooklyn had a busy signal Wednesday night.

Ransom has been arrested at least 11 times since 2012, records show, and he was wanted by police in connection with a Jan. 19 robbery at another cellphone store. After one arrest, court papers show, Ransom was taken to a psychiatric ward.

On social media, Ransom has styled himself as a comedian and prankster in the vein of Sasha Baron Cohen of "Borat" fame, filling Facebook and YouTube pages with videos of himself masquerading as a Speedo-wearing superhero.

At times, the two personas have blurred.

Ransom pleaded guilty to criminal trespass and was sentenced to 20 days in jail in 2016 after allegedly climbing over a gate and walking up to a desk at a Brooklyn police station while wearing a fake SWAT vest and police badge. Police records listed his alias as "Detective."

Four years earlier, he pleaded guilty and was sentenced to jail time for pretending to be an intern to gain access to a judge's chambers.

Meanwhile, on social media, he's posted videos of himself in his superhero garb stopping a subway train by jumping on the tracks and putting his hand up. In another, titled "Vigilante offers services to the NYPD," he shows up to a police precinct in the outfit.

Ransom sued the city over a 2015 arrest, alleging officers approached him on a street corner for no reason, cornered him in a store with guns drawn and took him to a psychiatric ward against his will. His charges were later dismissed, and he dropped the lawsuit in 2016.

Simonsen, 42, grew up in eastern Long Island, and he and his wife continued to live close by -- more than an hour's drive from the 102nd precinct where he worked his whole 19-year NYPD career.

Simonsen should have been off Tuesday for a union meeting, but he opted to work so he could continue tracking a string of recent robberies.

Since childhood he's been known as "Smiles" for his bright, welcoming personality. At Riverhead High School, he played football and baseball and was friends with everyone he met, childhood friend Melissa Weir said.

"Everyone is in complete shock. Everyone is feeling this," Weir said. "When you have somebody like Brian, it's really hitting everybody. There are people all over the place hurting."

Simonsen, Gorman and six uniformed officers swarmed to the T-Mobile store at around 6:10 p.m. Tuesday after a 911 caller standing outside reported seeing a man take two employees to a back room at gunpoint, Monahan said.

Simonsen and Gorman, who were both in plainclothes, were working on another case nearby when the call came and arrived around the same time as patrol officers, Monahan said.

The shooting started as Gorman and two of the uniformed officers retreated from the store when Ransom emerged from a back room and came at them, Monahan said. The gunshots blew out the store's doors, showering the sidewalk with glass.

Simonsen stayed outside as Gorman and the uniformed officers went in, Monahan said. Simonsen fired two shots. Gorman fired 11 times. It's not clear who fired the shots that struck them, Monahan said.