An armed suspect holed up in a stereo store in San Francisco’s Tenderloin on Friday fell through the ceiling and into the grasp of police while still holding a pistol and gold chain he’d just taken at gunpoint, officials said.

The dramatic episode was the culmination of an intense police chase involving plainclothes officers from the Tenderloin station, who witnessed the alleged robbery at Jones and Market streets.

Lt. Kevin Healy chased one of the suspects into the stereo store at 1080 Market and recounted the episode to The Chronicle shortly after his team apprehended the two men.

Neither suspect was immediately identified while they were being booked at San Francisco Jail. One suspect, though, had recently been arrested for murder, police said. The other was recently released from state prison after serving time for robbery.

The incident started while plainclothes officers were conducting surveillance on the notorious corner known for drug dealing and other illegal activity, police said.

Officers witnessed the two suspects confront a victim wearing a gold chain, Healy said. One of the suspects busted out a pistol and police watched as the victim’s chain fall to the ground, he said.

Plainclothes officers swarmed the area and caught one of the suspects at the scene after the victim and the second suspect took off running, police said.

Healy was in the area in full uniform and spotted a man with a backpack matching the description of the second suspect, he said.

“I was chasing him yelling ‘Stop! Drop it!’ believing he was armed,” Healy said.

The man then ran into the stereo store and disappeared behind piles of cardboard boxes, Healy said. Knowing the man was armed and that there was no rear exit, Healy backed off.

Police locked the place down as the suspect apparently when upstairs. Moments later, he came crashing through the ceiling and into police custody, gun and chain still in hand, Healy said.

Officers with the Police Department’s CSI team were processing the gun and chain.

Armed Robbery just now at Jones/Market: We had the intersection under surveillance when two suspects robbed a victim of his property. TL Cops swarmed in and took both into custody. One has a prior arrest for murder, 2nd suspect recently released from prison for robbery. pic.twitter.com/8tDhdm6A2j — SFPD Tenderloin (@SFPDTenderloin) January 25, 2020

Officials at Tenderloin Station tweeted a short synopsis of the events on Friday evening, spurring a wave of likes.

Supervisor Matt Haney, whose district includes the Tenderloin, retweet the post.

“Thank you @SFPDTenderloin officers for your courageous work to keep community safe,” he wrote.

Evan Sernoffsky is a San Francisco Chronicle staff writer. Email: esernoffsky@sfchronicle.com Twitter: @EvanSernoffsky