A tense standoff between police and a suspected car thief threatening to jump from a SoMa building ended safely Wednesday, after the man's cat was brought to the scene to coax him off the ledge.

According to California Highway Patrol spokesperson CHP Officer Vu Williams, the man, who has not been named by police, was driving a Toyota Highlander that has been reported as stolen at 2:41 p.m. Wednesday when a CHP officer pulled the driver over on Dore Street, near Harrison Street.

The man "fled from the stop on foot," Williams says, and ran into a two-story building on 10th Street near Harrison Street.

Shortly after he ran into the building, police saw him emerge from a second-story window. He dangled there, "shirtless, barefoot and threatening to jump" for about three hours, as a crowd gathered below.

That's when, says San Francisco Police Department spokesperson Officer Grace Gatpandan, a family member brought the suspect's cat to the scene, where the feline was "paramount" in getting the man to finally agree not to jump.

As Bay City News so eloquently puts it: "Officers shut down 10th Street and climbed the fire escape to talk the man down, according to police, setting up large foam mats on the ground and pointing less than lethal projectiles at him. Then the cat showed up."

The man, who Gatpandan says was likely in an "altered state," was safely taken into custody at around 6 p.m.