SAN FRANCISCO — SAN FRANCISCO — California’s most famous gulls are on TV during every game when the Giants are in town.

They fly over AT&T Park in the late innings, circling by the thousands. And as fans leave, they descend into the bleachers, furiously gobbling garlic fries, hot dog buns and any other food they can find.

But these gulls aren’t the same ones whose numbers are exploding along San Francisco Bay’s southern edges. They’re Western Gulls, a different species that lives and nests on Alcatraz and the Farallon Islands. And their Bay Area population — about 30,000 — has been flat, unlike the population of California Gulls, their cousins to the south.

Yet this baseball season, the Western Gulls have become an increasingly serious problem. Some nights hundreds land on the field, defecating on fans as they fly in and out. Late during a 16-inning game on July 8, so many swarmed the field they regularly flew in front of TV cameras, at times blocking the picture for viewers.

“It’s crazy, huh?” said Giants outfielder Andres Torres. “You look up there and they are everywhere.”

Shortstop Brandon Crawford said their white bodies swirl and dart in plain view as players bat.

“You’re focused on the pitcher,” he said. “But you definitely notice them.”

How do the gulls know when the games are almost over and snack time is near?

Gull biologist Russ Bradley of the nonprofit group PRBO, in Petaluma, said they may be lured by the stadium lights. Or perhaps by fans leaving the park toward the end of the game. Or maybe even by the organ playing “Take Me Out to the Ball Game” every seventh inning.

Nobody knows.

“They are incredibly intelligent animals,” Bradley said. “Unless you want to build a dome, there’s no easy answer.”

Giants officials say fireworks shows and large, clapping crowds keep the birds at bay. In late 2011, a red-tailed hawk whom the grounds crew nicknamed “Bruce Lee” began frequenting the park, and the gulls disappeared. But after a few months, so did Bruce Lee.

Giants officials can’t shoot the birds under federal law. And, hiring a falconer would cost $8,000 a game, said Jorge Costa, the Giants’ manager of operations. Besides, he added, what if a falcon killed some gulls on the field in front of families and on live TV?

For now, he’s stumped.

“It’s an issue we are taking seriously,” he said, forcing a smile. “But it’s delicate. You don’t want to get to the point where you do anything that looks inhumane.”

Staff writer Alex Pavlovic contributed to this report.