After a seven-hour standoff , early Thursday morning authorities dissuaded a white male from jumping off the edge of the roof of a five-story building on Valencia Street.

With the street below empty of pedestrians and traffic, firefighters and negotiators above worked patiently through the night, talking with the man, who sometimes dangled his feet over  the roof of the Crown Hotel at 528 Valencia St.

The police said their policy was to  wait him out and shortly after midnight the man relented and  officers escorted him to San Francisco General Hospital. Police said he was between 30 and 35-years-old.

Only hours earlier, police were a few blocks up near the Mission Playground and Pool where scenes from an upcoming segment of NBC’s Trauma were being filmed.  But the drama at the Crown hotel was unscripted and kept a crowd of pedestrians waiting to see what would happen.

The scene at 16th and Valencia. Photo by Rosa Ramirez.

The scene at 16th and Valencia. Photo by Rosa Ramirez.

The Crown Hotel is one of more than a dozen single-room-occupancy hotels in the area near 16th Street.  Residents rent by the week, but many are long-term tenants.

Several people near the scene of the incident said many of the hotel’s occupants have mental problems. The building, on the west side of Valencia between 16th and 17th streets, is the tallest building on the block, above the Limón restaurant.

Early in the siege, a man walked up to the yellow tape and told police he needed to go inside the hotel room for his medication.

“I’m starting to hear voices,” he said. Police escorted him into the building.

One passerby asked police, “Why don’t you guys lasso him?”

Police closed Valencia Street to all vehicles and pedestrians between 16th and 17th streets at 5 p.m.

Customers were prevented from walking into the many restaurants along the cordoned-off block.

“We don’t have any customers,” said William Virgil, one of the night managers at Puerto Alegre, a Mexican restaurant on the same block. “Zero.”

Clusters of pedestrians and residents at either end of the street were waiting for access. After 8 p.m., police escorted some residents into their buildings.

Bus service on the 26-Valencia was diverted down Mission Street.

Heather Duthie, Armand Emamdjomeh and Justin Juul contributed to this report.