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.

San Francisco 49ers quarterback Colin Kaepernick (7) fields questions at a press conference at the New Orleans Marriott on Canal Street in New Orleans, La., on Sunday, Jan. 27, 2012. The 49ers will play the Baltimore Ravens in Super Bowl XLVII at the Mercedes-Benz Superdome in New Orleans on Feb. 3. (Jane Tyska/Staff) (JANE TYSKA)

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.