SANTA CLARA -- Colin Kaepernick made a surprise visit to his alma mater's graduation ceremony Thursday night, the 49ers star quarterback showing up at Turlock's Pitman High to honor the graduates and a former coach who's retiring.

"I had to come back to say goodbye to two of my favorite teachers and also congratulate the graduates," Kaepernick said in a five-minute speech to stunned onlookers, according to the Modesto Bee. "I'm saying goodbye to one of my good friends and best coaches. I have a lot of great memories with him."

That coach, Brandon Harris, was as surprised as anyone to see Kaepernick appear on stage after the graduates received their diplomas, according to a 49ers spokesman who traveled with Kaepernick. Pitman principal Rod Hollars arranged for Kaepernick's visit as a nice sendoff for Harris and David Jack, another teacher who's retiring, the Bee reported.

Kaepernick was a three-sport star at Pitman before graduating in 2006 and heading to the University of Nevada. Drafted in 2011, Kaepernick helped lead the 49ers to last season's Super Bowl in only his 10th career start, and he just completed their second week of organized team activities.

For more on the 49ers, see Cam Inman's Hot Read blog at blogs.mercurynews.com/49ers. Follow him on Twitter at twitter.com/CamInman.