In a moving scene from the new prison documentary “Q Ball,” San Quentin inmate Harry “ATL” Smith is in his cell looking over prized snapshots of himself with Golden State Warriors star Draymond Green.

“I really want to get out and be somebody,” says Smith, who was recently released from San Quentin after serving an eight-year sentence. He was once a promising Atlanta basketball player with big dreams, who remembers competing against future NBA stars Dwight Howard and J.R. Smith. He played at San Francisco State before a downward spiral landed him behind bars on a domestic violence conviction. “My goal?” he says, in the documentary, looking at the image of himself smiling in his prison basketball jersey next to such a famous athlete. “… To suit up in a NBA jersey.”

The photos, which help keep his dream grounded, were taken on a fall day in 2016 when Green and his newly signed teammate Kevin Durant (“Q Ball” executive producer) visited the Marin County prison for the annual game between the Warriors’ coaching and operations staff and their namesake squad across the bay that plays only home games — the San Quentin Warriors.

Onscreen, inmate Brad “Bam” Shells recalls Green being asked while watching the prison team’s top talent if he “saw anyone out here who looks like he could play at the professional level, and he pointed to ATL,” a power forward who also goes by the nickname “The Phenom.” Still, Smith has stayed on the court and held onto his NBA dreams.

Smith is one of several SQ Warriors teammates profiled in “Q Ball,” which has its world premiere at the SFFilm Festival on Thursday, April 11. Other ballers include Anthony “Ant” Ammons, sentenced to 102 years to life for a crime committed at age 16; Allan “Black” McIntosh, a stoical three-strikes offender; and the team’s demanding head coach, Rafael Cuevas. Cuevas has become a mentor to the 15 men who vie each year to make the prison team and earn the opportunity to compete against visiting civilians on Saturdays.

Cuevas instills an ethic of teamwork and personal accountability in his players, and he talks about using coaching to “try to reach somebody, save somebody,” as a kind of recompense for the remorse he feels over his well-publicized crime — the murder of a 21-year-old Redwood City Giants fan outside AT&T Park in 2004.

To a man, the inmates in “Q Ball” struggle with reconciling their past criminal behavior with the fact that, after extensive self-examination in a correctional facility that prioritizes rehabilitation, many of them have dug deep to change, to reclaim their moral center and sense of purpose — and basketball has played a role in their redemption.

“I know it’s a cliche to talk about sports teaching life lessons that are bigger than what’s on the court, bringing people together and breaking down boundaries,” said Michael Tolajian, director of the film. “But that’s literally what we saw happen. ‘Q Ball’ ended up being about these inmates’ journeys to become better men.”

Tolajian, who has won two Emmy Awards for his sports films, moved from the East Coast to Moraga five years ago, and had driven by San Quentin “dozens of times and wondered what the men in there are really like.” His friend, producer Jordan deBree, had filmed a short feature on the prison’s baseball team and told Tolajian about the SQ Warriors.

“I was definitely intrigued, especially after hearing about the Golden State Warriors’ involvement with them,” Tolajian said. He shot a five-minute “sizzle reel” of the inmates talking and playing. The footage inspired Durant, who had launched his Thirty Five Ventures company, to sign on as executive producer for the feature film that will air on Fox Sports’ Magnify series May 28.

“My first visit to San Quentin with the Warriors was an experience I could never forget,” Durant wrote via email. “Despite their circumstances, the inmates were using basketball as a positive force and a way to keep going, which was really remarkable. With this doc, we wanted to tell these individuals’ stories in more depth, using basketball as the lens.”

Tolajian recalled that during his interviews with the inmates, “One of them made this memorable comment: ‘When people like (KD) come in here and start caring about you, then maybe you start caring about yourself.’ ”

Tolajian filmed extensively at San Quentin from April to December of last year and was surprised by “how open and willing a lot of the men were, telling their tales to me in incredible detail of what brought them to prison, all the way back to their childhood circumstances.”

Smith, 31, is the central character of “Q Ball.” He was the team’s charismatic star and clearly the best on the court,” Tolajian said. “But also because he was the only one who we knew had a real, approaching release date. He was young when he got to prison, and he’s matured and learned some hard lessons. He’s gone through a lot of introspection and a lot of change.

“To me, this is a story of a group of men who are trying to salvage their lives before it’s too late. They’re trying to find purpose and meaning while they still have some life ahead of them, whether they have life sentences, or are getting out soon.”

And for some, basketball can provide that, even when other interventions have failed.

Even though San Quentin is renowned for offering inmates an enviable range of educational and vocational opportunities, as well as rehabilitative counseling and restorative justice programs, “basketball is one of the best ways to embrace some guys who are really far from growth,” coach Cuevas says in the film. We see him insist on accountability, calling out Smith for being a hothead on the court, and benching another player for a “dirty pee test,” But he also inspires his team to work together and dig deep for a win the way any great coach would — and in a way these incarcerated players truly need.

“The meanest, toughest guys on the yard will tell you, ‘I’m never going to a self-help group. But I’ll play some basketball with you,’ ” coach Cuevas says in the film. “That’s the opportunity to maybe take a baby step with a guy.”

“Q Ball”: 7 p.m. Thursday, April 11. (Executive Producer Kevin Durant will attend.) Tickets: $20 for SFFilm members, $25 for the general public. Castro Theatre. Part of the 2019 SFFilm Festival. www.sffilm.org