SAN FRANCISCO — A celebration in San Francisco’s streets over the Giants’ World Series victory turned raucous and violent in some areas with people injured by gunfire, officers hurt by bottles thrown by revelers, and police making arrests.
The partying unfolded peacefully with fans gathering in the streets and uncorking champagne, lighting bonfires, dancing in a mosh pit and hugging strangers on Wednesday night as their team scored its third series win in as many championship appearances, a triumph all the more gratifying by its arrival at the end of a seventh, winner-takes-all 3-2 game.
‘‘I knew they were going to win. It’s the Giants. They do this all the time,’’ San Francisco native Barbra Norris, 54, said of the team’s odds-defying win in an away game played the night after a crushing shutout in Kansas City.
But in some areas, the atmosphere grew rowdier as the night wore on.
Violence left three people injured in separate incidents, two by gunshots and one in a stabbing, police spokesman officer Gordon Shyy said. The gunshot victims’ wounds were nonlife-threatening, but he didn’t have information on the stabbing.
Shortly after the celebrating began, Shyy said officers made ‘‘a handful of arrests’’ as fans filled the streets and blocked traffic around the Civic Center, in the Mission District and on Market Street within walking distance of AT&T Park. No updated arrest figure was available later.
‘‘Police personnel were assaulted with bottles on Market Street and Mission district. Officers in the Southern district were also struck with bottles,’’ Shyy said. ‘‘These objects were thrown at officers as they attempted to disperse crowds and assist firefighters extinguish bonfires.’’
Shyy said multiple officers suffered minor injuries, but did not provide an exact number. He also said one was treated at a hospital for injuries.
The San Francisco Chronicle reported that the region around Third and King streets was especially raucous with thousands of fans spraying beer on one another, smashing bottles, lighting fires and setting off fireworks. That prompted police in riot gear to move in and set up a perimeter.
The paper said that at one point riot police lined up three rows deep, prompting some people to hurl bottles, some shattering on the street and others hitting cringing officers.
The wild street scenes lasted into the early hours Thursday. Shyy said crowds were still in the streets in some areas and stoking bonfires shortly after midnight, prompting officers to continue efforts to clear the areas. But by 1:30 a.m. PDT, he said that the crowds for the most part had dispersed.
Earlier in the evening, across from San Francisco City Hall, where the exterior lights had been glowing orange all week, more than 9,000 people gathered in an outdoor plaza where the city had set up a Jumbotron and a vendor sold hot dogs but no beer.
‘‘You come out here to feel the pulse of the city. When it’s the 7th game, you want to get the vibe,’’ Geoff Goselin, 61, said as he watched the game through the branches of sycamore trees that partly obscured the giant screen.
The diverse crowd sang ‘‘Let’s Go, Giants’’ whenever their counterparts 1,800 miles away rooted for the home team and chanted a prophetic ‘‘M-V-P’’ whenever Giants ace Madison Bumgarner took the mound.
‘‘Bumgarner is the beast, the man,’’ Aden Bacus, 41, shouted after the exhausted pitcher secured a series of strikes on the heels of giving up a gasp-inducing triple. ‘‘I'd be lying if I told you I wasn’t nervous there at the end.’’
The San Francisco Police Department maintained a heavy presence, but also a cool distance as marijuana smoke wafted over Civic Center Plaza and jubilant fans set off fireworks and popped open cans of Pabst Blue Ribbon that someone was selling out of a cooler.
One indication of the mood there was that several fans said they would have been able to stomach a Royals victory with a shrug, if not a smile.
‘‘It would have been really cool for Kansas City to win the World Series at home,’’ David Janmohamed, 23, said.