A California man who spent 11 years in prison for five armed robberies he did not commit walked free Tuesday after he was exonerated, thanks to the investigative work of his wife.

Ruben Martinez Jr. was convicted of five robberies at the same auto paint shop from 2005 to 2007. All five appeals were originally rejected in 2008. He walked out of Los Angeles County Superior Court this week after prosecutors reviewed his claim of innocence and agreed he had been wrongly convicted.

Ruben Martinez Jr., right, and his wife, Maria, left, spoke to reporters at the Hall of Justice in downtown Los Angeles, on Tuesday, Nov. 12. (AP Photo/Brian Melley)

Ruben Martinez Jr., right, and his wife, Maria, left, spoke to reporters at the Hall of Justice in downtown Los Angeles, on Tuesday, Nov. 12. (AP Photo/Brian Melley)

Martinez’s wife and a former detective with the Los Angeles County Sheriff’s Department tracked down alibi witnesses, who were able to confirm that Martinez was at work and could not have committed the crimes.

District Attorney Jackie Lacey apologized to Martinez for the injustice that led to his 47-year prison sentence.

CALIFORNIA WOMAN CLAIMS HOMELESS MAN DUMPED BUCKET OF HOT FECES ON HER HEAD

Eyewitnesses had originally identified Martinez as the assailant, and at the time his alibis were not fully presented. He was later convicted of nine counts of second-degree robbery during a retrial for the case.

"I did not do this time by myself," Martinez told ABC 7. "My family did time. My wife did time with me, did the 11 years with me. I couldn't do it on my own."

“Although the vast majority of convictions are correctly upheld, I know that, at times, the pursuit of justice is not perfect," Lacey said in a statement. "And Mr. Martinez's case serves as a stark reminder to all of us: Despite our efforts, we don't always get it right."

CLICK HERE FOR THE FOX NEWS APP

The Conviction Review Unit, established in 2015, has overturned a total of three convictions, including Martinez’s. His case was the first time in L.A. County that an inmate has been exonerated without an attorney, according to prosecutors.

There are 45 pending claims currently under review by the unit, according to ABC 7.

The Associated Press contributed to this report.