The shooting began around 10:40 p.m. Tuesday as authorities were dispersing thousands of revelers under a curfew aimed at controlling the traditionally raucous party. Police reported the suspect was wearing a black mask and was seen fleeing the scene down Market St. immediately after the shooting.
Two people were detained for questioning, but no one had been arrested early Wednesday, police Capt. Al Casciato said. He said two groups of people had gotten into an altercation when the shooting began.
One victim was listed in critical condition at San Francisco General Hospital.
The once-spontaneous and unsanctioned party was taken over by the city four years ago after police recorded five stabbings and a number of assaults in a 2002 crowd of 500,000 people and confiscated a chain saw.
Officials and members of the district's large gay community said the party had started attracting gay bashers along with the usual colorfully costumed characters.
On Tuesday night, city officials ramped up the police presence, reduced the number of entertainment stages from three to one and cut off the festivities at 11 p.m.
"We had the sheriff's department screening people for weapons and alcohol. Obviously you have a major event — a lot of different spots" to patrol, said police spokesman Neville Gittens said. "I can't explain how this happened. Unfortunately it did happen, and we are investigating to find out who is the cause of the shooting."
Ted Morales, 43, said he was working as a volunteer security guard for the event when he "heard someone empty their gun" in the crowd.
"When the shooting happened, people just dove to the ground like a wall of water," said Morales, who did not see what led up to the shooting. A woman standing near him was grazed in the neck by a bullet, he said.
Sophia Vlahiotis, who owns Capri Ristorante Pizza just yards from the scene, was outside selling pizzas when a crowd of people fleeing the bullets began running in her direction.
"They pushed the table over, the oven fell and then I realized it was gunshots," she said. "They were trying to get into the restaurant, there were so many people."
Vlahiotis, who did not see what led up to the shooting, said this year may be her last participating in the Halloween party.
"I'm still shaking," she said. "I don't know if I want to do this again. It's not worth my life."
Security checkpoints were set up around the nine pedestrian gates into the street party, with police screening people for alcohol or weapons. Even those carrying weapons meant to be part of a Halloween costume were to be turned away.
An estimated 250,000 revelers were expected to cram a few city blocks in the Castro Tuesday night.