Around 10:45 p.m. Saturday, three men were seen with a gun on Sixth Street at Mission Street, San Francisco police Officer Albie Esparza said.
Apparently one of the men had fired several shots across Sixth Street. No one was injured, Esparza said.
As officers approached, the three suspects fled into a residential hotel building and refused to come out of a room there, police said.
Crisis and hostage negotiators were called to the scene as the men stayed holed up in the room for about two hours, police said.
Eventually the three surrendered and were taken into custody. Esparza said the men are San Francisco residents Maurice Brown, 34; Julius Johnson, 25; and Devonta Butler, 21.
Brown was arrested on suspicion of a weapons violation and shooting into an inhabited building along with other offenses. The other two suspects were arrested on suspicion of weapons violations and resisting arrest.
Police allegedly recovered two guns from the men, Esparza said.