Facebook founder Mark Zuckerberg spent time behind bars for his latest cause: criminal justice.
Along with his wife, Priscilla Chan, Zuckerberg visited San Quentin, one of California's most notorious prisons.
"Making our criminal justice system fairer and more effective is a huge challenge for our country," he wrote on a Facebook (FB) post.
Zuckerberg lauded San Quentin as having one of the best track records when it comes to reducing the rate of recidivism.
"They run programs to teach valuable skills to help inmates find jobs and avoid criminal activity," he wrote.
San Quentin has become known for its progressive approach to inmate programs.
Zuckerberg made a guest appearance at a class called Code.7370, an intensive course where inmates learn to code four days a week, eight hours a day for six months. Chris Redlitz, who cofounded the program with his wife Beverly Parenti, tweeted that Zuckerberg offered valuable insight.
Related: Hire a coder behind bars
"There's no reason why we can't teach someone in San Quentin -- there's many smart people in San Quentin -- to be a very proficient coder," Redlitz told CNNMoney during a visit to the class last year. "Why not keep those jobs in America?"
The class is part of a program called The Last Mile, a nonprofit that teaches prisoners about entrepreneurship. Inmates who become a part of The Last Mile spend months building out a startup concept and then pitch their ideas in front of other inmates and investors during a prison Demo Day.
Inmates who've graduated from the program have gone on to join accelerators and build their own startups in the Bay Area.
According to Redlitz, Zuckerberg toured an area at San Quentin that's being built for a tech incubator before asking to meet some of the inmates.
"He really wanted to go into the classroom and talk to the men," Redlitz told CNNMoney.
The visit was a surprise for inmates who've been learning about major tech figures from behind bars for years.
"Everybody in that class knows who Mark Zuckerberg is even though they've never been on Facebook. He's idolized," Redlitz said.
A handful of inmates showed Zuckerberg the projects they were working on. One project was a data visualization of stats about incarceration rates.
"He was super engaged," Redlitz added. His message for inmates: "What you're doing is important -- the market needs developers."
"I had the most awesome day," one inmate who met Zuckerberg said. "Him and his wife were really cool. We talked for about 30 minutes."
Zuckerberg wrote that he was impressed by the desire of the inmates in Code.7370 to give back to their communities and provide for their families.
"I'm going to keep learning about this topic, but some things are already clear," he wrote. "We can't jail our way to a just society, and our current system isn't working."