Nearly a decade into his life sentence for murder, Lydell Grant was escorted out of a Texas prison in November with his hands held high, free on bail, all thanks to DNA re-examined by a software program.

"The last nine years, man, I felt like an animal in a cage," Grant, embracing his mother and brother, told the crush of reporters awaiting him in Houston. "Especially knowing that I didn't do it."

Now, Grant, 42, is on a fast track to exoneration after a judge recommended in December that Texas' highest criminal court vacate his conviction. His attorneys are hopeful a ruling is made in the coming weeks.

For Grant to get to here hinged on two prongs: the DNA evidence, which was reanalyzed through an emerging software that has also come under scrutiny, and an unprecedented decision to use the findings to conduct an FBI criminal database search that was initiated by a third party not part of the initial investigation. That led to the discovery of a new suspect, who has been charged after police said he confessed.

The search process used in Grant's case has enormous potential to solve cold cases or re-evaluate other convictions that could pave the way for more exonerations nationwide, forensic scientists say.

"There's probably 5,000 or 6,000 innocent people in Texas prisons alone," said lawyer Mike Ware, executive director of the Innocence Project of Texas, which is representing Grant. "How many of them could benefit from such a reanalysis of DNA that was used to convict them? I don't really know, but this is a historic case that could open the door for those who thought it was shut forever."

A match in the database

Grant's ordeal began in December 2010, when Aaron Scheerhoorn was stabbed outside a Houston gay bar. Authorities said Scheerhoorn, who was bleeding from his abdomen, had run to the bar's entrance seeking help from horrified bar patrons and employees. The witnesses described the killer as a black man, about 25 to 30 years old and around 6 feet tall. Police told local media that it may have been a "crime of passion."

A tip came in about a car that might belong to the suspect. Five days later, an officer pulled over a vehicle matching its description, and Grant, who at the time was driving on a suspended license, was taken in for questioning.

Investigators also interviewed seven witnesses, all but one of whom picked out Grant as the suspect from a photo lineup.

Grant, then 33, had a criminal record going back several years, including aggravated robbery, marijuana use and theft. But he maintained his innocence in the stabbing, said he had never met Scheerhoorn and produced an alibi for his defense.

At Grant's trial in 2012, prosecutors centered their case on the eyewitness testimony — a practice that the Innocence Project argues plays a major role in defendants' being wrongfully accused. In addition, jurors heard about DNA collected from fingernail scrapings from Scheerhoorn's right hand. The DNA was actually a mixture of that of two people: the victim and a second male profile.

Houston's police crime lab at the time was unable to conclude that the other genetic material was Grant's, and the state's expert's testimony suggested to the jury that it "could not be excluded."

Jurors also heard from Grant's alibi witness, who said he was with Grant on the night Scheerhoorn was murdered, but his testimony failed to sway them, court documents show.

Grant was found guilty of first-degree felony murder. From his jail cell in Harris County, he began writing to anyone he thought could help.

A letter eventually landed on a pile at the Innocence Project of Texas, which receives hundreds of inmate letters every month. In 2018, it was referred to the Texas A&M School of Law, which partners with the Innocence Project of Texas.

"We knew at the very least the prosecutor put on inaccurate testimony at trial," Ware said. "We didn't know where the facts were going to lead to."

The law students got to work, paying particular attention to the DNA report that described the mixture of genetic materials. In 2011, the Houston crime lab had analyzed it using a traditional method in which a forensic scientist studies the genetic makeup of the DNA sample, which is translated into a type of graph that can be reviewed manually, and determines the probability that a particular person's DNA matches the sample. But when a sample includes a mixture of DNA from more than one person, it is increasingly difficult to separate and interpret the data. Flawed DNA readings by analysts have been known to ensnare innocent people.

After Ware and the students took a fresh look at the original DNA report, they were convinced that Grant's DNA could not have been a part of the mixture. Last March, Ware began working with DNA expert Angie Ambers, an associate professor of forensic science at the University of New Haven in Connecticut.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Ambers was familiar with a type of DNA technology known as "probabilistic genotyping."

"Years after Lydell Grant was convicted and sent to prison, there was a paradigm shift in how we interpreted DNA mixtures in criminal casework," she said. "Rather than having a human DNA analyst interpret a mixture of DNA, computer software programs were developed to reduce the subjectivity in interpretation."

Mike Ware walks out of the Bexar County Jail in San Antonio on Nov. 18, 2013, as part of a case in which four women wrongfully accused of sexual assault were later exonerated. Eric Gay / AP file

Ambers learned of one such software program created by Cybergenetics, a small company in Pittsburgh that had analyzed DNA samples from unidentified victims of the terrorist attacks of Sept. 11, 2001.

It was worth a shot: Ware requested the raw DNA data from the Harris County District Attorney's Office, and then it was shared with Cybergenetics and run through its program, TrueAllele. (The name is a play on the word that signifies the different forms a person's genes can take.)

The company offered a free preliminary screening, and the software did what a human could not do: determine that Grant's DNA did not match that of the unknown male profile.

Ambers had a hunch that something was off when she first reviewed the case because a large number of alleles present in the DNA mixture were inconsistent with Scheerhoorn's or Grant's profiles. But she said TrueAllele's discovery alone wouldn't guarantee that Grant would be cleared of a crime.

Armed with the new evidence, the Innocence Project of Texas went a step further, prompting Cybergenetics to work with a partner crime lab in Beaufort County, South Carolina, which has access to a powerful FBI database known as the Combined DNA Index System, or CODIS.

Typically, federal, state and local law enforcement and government crime labs can upload an unknown profile into the database and compare it for a possible match against that of one of the more than 14 million convicted criminals and those arrested already in the system. The process, for instance, can help authorities link crimes from several scenes to a single person.

The South Carolina crime lab's search resulted in a hit. The DNA profile belonged to a man in Atlanta named Jermarico Carter, who police say left Houston shortly after Scheerhoorn's murder. Carter also has a lengthy criminal record, and Houston Police Chief Art Acevedo said in a statement in December that he confessed to the killing.

Acevedo at the time also issued a rare apology to Grant and his family, "as they have waited for justice all these years."

Trusting the source code

Cybergenetics CEO Mark Perlin, the developer of TrueAllele, said the use of a probabilistic genotyping software's findings in CODIS is significant, as it's the first time it was attempted because an independent party, the Innocence Project, requested it, not law enforcement. And most remarkably, it resulted in a match.

He touted his software, which runs DNA data through a statistical algorithm with 170,000 lines of code, for being able to untangle DNA mixtures.

The mixtures "have a complex pattern based on how much of each person is there along with distortions," Perlin said. "A computer can account for that and dig deeper into the data to get far more information."

But while TrueAllele has been lauded for helping both prosecutors and defense attorneys get to the bottom of cases, and while it has been used in crimes labs in Baltimore; Cleveland; Bakersfield, California; and elsewhere, the technology also has detractors.

Some who favor transparency ask how, if the patented program's source code is decipherable only by the company, it can be trusted to be accurate every time.

Greg Hampikian, a biology professor at Boise State University who was an expert consultant in the high-profile case of Amanda Knox, credits TrueAllele with helping to free the wrongly convicted in other cases he's worked on. But he also supports the release of the software's source code and believes that if prosecutors have the same access to such a program for a trial, then the defense must, too. He acknowledged that there are difficulties to ensuring that a defense team can be fully trained to "counter these highly sophisticated mathematical programs without having actually used them." They can also be cost-prohibitive, running in the tens of thousands of dollars.

If probabilistic genotyping software is being used in trials, defendants should have every opportunity to know how the algorithm came to its conclusion to mount a capable defense, said DNA expert Dan Krane, the interim dean of Wright State University's Lake Campus in Ohio.

"There's a conflict between a defendant's constitutional right to confront the witnesses versus an inventor's right to protect the intellectual property associated with their invention," Krane said.

Judges in several cases throughout the country have rejected attempts to force private companies to reveal the formulas behind their software.

In 2016, however, a federal judge in New York ordered the release of the source code for a software tool developed by New York City's crime lab, which was the subject of a ProPublica report that found "increased complaints by scientists and lawyers that flaws in the now-discontinued software program may have sent innocent people to prison."

Perlin has argued in court filings that TrueAllele's source code is a "trade secret" and one that must be protected in a "highly competitive commercial environment." (Its main competitor is the software STRMix, which is being used in more than 50 forensic labs across the country, including the Houston Forensic Science Center, an independent agency that replaced the Houston Police Department's crime lab in 2014 after past scandals.)

For criminal cases, Perlin said, his source code can be provided to defense experts at no cost under a confidentiality agreement.

Download the NBC News app for breaking news

The issue has caught the attention of lawmakers. Rep. Mark Takano, D-Calif., introduced legislation in September that would require defendants to be provided with access to source code and standards put in place to ensure that the algorithm used was fair. The Justice in Forensic Algorithms Act has been referred to the Judiciary Committee and the Committee on Space, Science and Technology.

While some experts are wary of how the technology may be applied in cases, they do see a benefit in using its findings to locate a profile match in CODIS. But the FBI, which has used STRMix for cases, has been reluctant to allow third parties like the Innocence Project of Texas direct access to the database, instead requiring that they specifically go through law enforcement or crime lab sources to perform a CODIS search.

Supporters of opening the database argue that, sometimes, law enforcement and crime labs involved in the original case can't be counted on to run a new search in a timely manner, particularly if the results threaten to undermine an existing investigation.

In response to questions from NBC News, the FBI said CODIS remains a "tool legislatively authorized for law enforcement use only." In addition, the agency said it uses STRMix for one of two functions: to "help a human figure out DNA mixtures (and therefore possibly put a better profile into CODIS)" or to highlight the likelihood that two profiles are, indeed, a match.

Perlin sees his DNA technology at the forefront when it comes to solving more cases, but he said that will also depend on whether crime labs like the one in South Carolina are willing to partner with third parties that use probabilistic genotyping software.

He said Cybergenetics will continue to help prisoners who may have been wrongfully convicted and believes that partnerships with crime labs can grow, although only "to the extent that the FBI lets them."

"These labs want to use better science to get better justice for all parties," Perlin added.

Grant's case, proponents of the DNA technology say, could prove to be the shining example to get more people on board.

HPD Chief @ArtAcevedo met with Lydell Grant and the Innocence Project this afternoon. The two were able to officially meet after Grant was released from prison following a wrongful murder conviction. They spoke about the criminal justice system and keeping hope and faith alive. pic.twitter.com/HxRwvBT22R — Houston Police (@houstonpolice) January 21, 2020

While awaiting the court's finding that he is officially exonerated, Grant, who remains free on a $100,000 bond, told reporters in December that he isn't angry with prosecutors and has put his faith in God. And he sees a silver lining for others wrongly convicted.

"I really believe that my story will be able to help someone else's," he said.