A California man has been exonerated and freed from prison after serving nearly 30 years on a rape conviction.

Gerardo Cabanillas was released from prison Tuesday after serving 28 years for the 1995 attack of a couple sitting in a parked car in South Gate, California, with DNA testing finding that he was not one of those responsible for the incident, according to a report from CBS News.

The 1996 conviction of Cabanillas was re-examined by the District Attorney's Office, with DA George Gascón calling the case a "grave injustice" in a statement Tuesday.

WRONGFULLY CONVICTED MAN WALKS FREE AFTER MORE THAN 2 DECADES AS PODCAST SHED LIGHT ON HIS MURDER CASE

Gerardo Cabanillas outside courthouse in LA

Gerardo Cabanillas waves from outside the Hall of Justice in downtown Los Angeles after his release on Tuesday. (Laurence Colletti/Legal Talk Network via AP)

"We acknowledge a grave injustice that has resulted in the unjust more-than-28-year incarceration of Mr. Cabanillas," Gascón said. "Upon thorough reexamination of the evidence and a comprehensive review of the case by my office's Conviction Integrity Unit, it has become abundantly clear that a serious error was made. I extend my deepest apologies to Mr. Cabanillas for the miscarriage of justice and the failure of our criminal legal system. ... It is imperative that we reflect upon this case as a stark reminder that our criminal legal system is not infallible."

Cabanillas confessed to being one of two armed men to attack the couple in 1995, forcing the man out of the parked car and driving the woman to an abandoned house where the two men raped her. However, according to the Innocence Project, Cabanillas only confessed to being part of the crime because a detective told him he would get probation and be able to go home if he admitted guilt.

"False confessions are one of the leading causes of wrongful convictions in the United States," Innocence Project interim director Alissa Bjerkhoel said in a statement, according to CBS News. "Police are permitted to lie to suspects, including promises of leniency if the person confesses. That is exactly what happened here and, if it was not for the DNA evidence, Gerardo would have spent the rest of his life in prison."

Gerardo Cabanillas, left and George Gascon at news conference

Los Angeles County District Attorney George Gascón, right, announces the exoneration of Gerardo Cabanillas, left, after more than 28 years in prison for crimes he did not commit. (Francine Orr / Los Angeles Times via Getty Images)

CLICK HERE FOR MORE US NEWS

The victims of the attack were told about Cabanillas' confession by police and identified him in a photo lineup, but they expressed doubts in court that they had identified the right person and said they felt pressured into picking him.

No other suspects were arrested in the case, though one man later confessed to comitting one of at least two similar crimes that happened in the same area.

According to the Innocence Project, DNA testing of the rape kit revealed that two other people were responsible for the assault.

A judge has now reversed Cabanillas' conviction, finding him factually innocent last week and ordering his permanent release.

Gerardo Cabanillas at news conference

Gerardo Cabanillas. (Francine Orr / Los Angeles Times via Getty Images)

CLICK HERE TO GET THE FOX NEWS APP

"We are thrilled for Gerardo and his family that the truth has finally set him free," Bjerkhoel said.

The Los Angeles DA's office did not immediately respond to a Fox News request for comment.