Midway through the second quarter, with the home team up 30-29, a voice blared over the loudspeaker: “Alarm on the yard! Alarm on the yard!”

The couple hundred inmates who had gathered Friday for San Quentin State Prison’s most anticipated sporting event — even those in blue Adidas jerseys with “Warriors Basketball” across the chest — crouched to the pavement.

A handful of civilian visitors dressed in mesh green pinnies exchanged puzzled glances, seemingly unsure whether to fall to the ground or climb the nearest razor-wire fence.

“Those alarms happen all the time around here,” said Lonnie Morris, who has served 40 years of a lifetime sentence, after inmates were given the all-clear. “For most of the guys here, it’s part of their muscle memory at this point.”

For the Golden State staffers who had to surrender their personal belongings to play in the prison, the false alarm was yet another reminder that this was no ordinary pickup game.

Members of the Warriors’ operations staff, headlined by general manager and two-time NBA Executive of the Year Bob Myers, have played a game in San Quentin yearly since 2012. In that time, those players — known collectively as the Green Team because of the color of their scrimmage jerseys — have become friendly with numerous inmates.

Last summer, outside a chicken and waffles restaurant in San Francisco, Myers was ecstatic to run into a man he had met in San Quentin.

“A lot of people think we come in here and want the exposure,” Myers said. “But the truth is, we come in here just to interact with these guys, show them that they matter. I just heard a couple of them are getting out soon, which is the best news.”

Commitment required

Rather than dwell on their bleak circumstances, many inmates on the yard prefer to give thanks. In San Quentin, they have opportunities inmates at other penitentiaries would envy. This lower-security prison on the edge of the San Rafael Bay has the only on-site college-degree-granting program in California’s prison system. There is a media room with new Apple desktop computers, an inmate-run newspaper, a stock-trading program, and baseball, tennis, soccer and basketball teams.

No squad is more exclusive than the San Quentin Warriors. Of the roughly 75 inmates who tried out this year for the prison’s premier basketball team, only 15 made the cut. The San Quentin Warriors practice on Tuesday and Thursday evenings for their Saturday games against civilians.

Unlike recent years, when the San Quentin Warriors’ dominance had mirrored that of their NBA namesakes, they are slogging through a bit of a rebuild. The team is still adjusting to first-year head coach Rafael Cuevas, who took the job when longtime coach Daniel “Bear” Wright recently was transferred to another prison.

More than wins, Cuevas’ focus as a coach is on keeping his players accountable. To don the blue jerseys Golden State officials donated last year, San Quentin players must be enrolled in at least one self-improvement program and stay out of trouble.

It is a path Cuevas has traveled: He is well into a sentence of 16 years to life for stabbing 21-year-old Redwood City resident Timothy Griffith to death outside AT&T Park after Griffith reportedly banged on the window of Cuevas’ car. A 52-week program called Guiding Rage into Power helped him better understand what triggered his deadly outburst on that fall night.

There are no exceptions to the accountability rule. One of the San Quentin Warriors’ top players missed Friday’s game after getting written up earlier in the week.

“The fans don’t like it because they lose,” said Brian Asey, a longtime inmate who calls himself the “GM” of the Warriors. “But it’s about more than winning and losing. It’s about getting the most out of this experience.”

Circled on the calendar

San Quentin plays teams from all over the Bay Area, but perhaps its most formidable opponent is the Green Team organized by Bill Epling, a Silicon Valley software executive. Epling’s squad, which faces the inmates on the first and third Saturdays of the month from April through November, entered Friday 6-1 on the season.

Six years ago, Golden State assistant general manager Kirk Lacob — a regular on Epling’s Green Team — convinced some friends from the office to join him. The experience so resonated with them that the game became an annual tradition.

These days, the Golden State operations staff’s visit is the highlight of San Quentin’s athletic calendar. For months before the game, the chow hall is abuzz about which players might tag along to the game.

Many of the inmates, even the ones who are Lakers fans, watch as many Golden State games as possible inside their cells on TVs bought from an approved catalog for a few hundred dollars. Meeting Draymond Green and Kevin Durant last year is a cherished memory.

“Do you have any idea what it means to have one of those guys call you by your name?” Asey said. “It’s special.”

Around 8:40 a.m. Friday, the visitors sprayed on sunscreen and dressed in their green jerseys in San Quentin’s parking lot as Epling detailed a list of rules. It was very important, he stressed, that no player visit a prisoner’s cell without first notifying a supervisor.

After handing over their wallets, cell phones and car keys to Don Smith, a volunteer pastor and retired engineer who helps organize the games, players showed their IDs to a prison guard, got stamped on their right wrists and signed into California’s oldest correctional institution. The gates locked behind them. Greeting them at the entrance was a sign for the “Adjustment Center,” the only death row for men in the state and the largest in the country, with 725 men housed there.

“Are you scared?” Cuevas asked a reporter making his first trip to the prison. “I wouldn’t blame you if you were, but I think you’ll see there’s nothing to be afraid of.”

The players walked down a hill, past a 19th century dungeon, to a yard overseen by four watchtowers. While a couple dozen inmates traded daps with their visitors and rubbed the Larry O’Brien NBA championship trophy, brought for the visit, others watched the scene from a distance. Eight men, lined up on cement near the basketball court rimmed with barbed wire, barely glanced up as they hammered out pushups.

Not like Oracle Arena

By the time the Green Team and San Quentin started warm-ups, most of the inmates in the yard had surrounded the court. Hip-hop music thumped. There were inmates working as a statistician, timekeeper and scoreboard operator. Two prisoners trained in NBA rules assisted a local high school referee with the officiating. Because whistles are a distress signal in San Quentin, they used duck calls.

Golden State center JaVale McGee served as color commentator in the first half before giving the responsibility to KGO sports anchor Larry Beil so that he could challenge some inmates in dominoes. Aaron Taylor, an inmate who grew up in Southern California idolizing Lakers play-by-play announcer Chick Hearn, called all the action.

Taylor’s colorful brand of play-by-play helped make those involved feel more like they were at Harlem’s famed Rucker Park playground, a summer league staple, than in a prison that once housed Charles Manson. When Myers was fouled shooting a three-pointer, Taylor quipped that Myers “couldn’t make those free throws if they offered parole.” A while later, when the referees missed a blatant foul call, Taylor warned that’s “what happens when you commit a crime in front of everybody: Nobody sees it. They gotta catch it on video.”

The Green Team featured former players for Division I programs Fordham, Florida State and UCLA. San Quentin’s best player, Harry “ATL” Smith, had topped out as a walk-on at Division II San Francisco State. It didn’t matter. The San Quentin Warriors dived for loose balls, attacked the rim and dug out of an early hole to lead the Green Team by two points with 15.3 seconds left on the clock.

Fouled on a corner three-point try, Golden State video intern Khalid Robinson hit all three of his free-throw tries to give the Green Team a 102-101 lead. Cornell “Fatality” Shields, an athletic swingman with an NBA-ready frame, took the inbounds pass, drove upcourt, slid past a defender and converted the go-ahead layup.

Down to the last play

Trailing by a point with six seconds left, the Green Team went to Myers for the game-winning shot. The man who has ruled this annual matchup — he had 32 points and 31 rebounds Friday — lost the ball as he tried to spin around a defender.

Time expired. Inmates swarmed Shields. It was just the second time in six years, and the first since 2014, that the home team had toppled its famous visitors.

“The win is huge, but the program is even bigger,” said Cuevas, who finally had a statement victory. “It just gives us a chance to realize our own humanity. These famous people from a different kind of society come in here and see us as equals. They take time out of their lives just to see us as basketball players — and good basketball players at that. That means so much to us, you don’t even know.”

While the inmates gathered for a team photo, a familiar voice blared over the loudspeaker: “Alarm on the yard! Alarm on the yard!” Even in that triumphant moment, they paused the celebration and crouched to the pavement.

Connor Letourneau is a San Francisco Chronicle staff writer. Email: cletourneau@sfchronicle.com Twitter: @Con_Chron