Image caption Lashonda Moreland outside of the home where she was arrested

In St Clair County, Illinois, the local prosecutor is trying a radical new experiment: admitting his office has charged innocent people with crimes and clearing their names before they spend a day in prison. It's a unique reform effort as prosecutors around the country face increased scrutiny and diminishing public trust.

Lashonda Moreland's day had barely begun when the pounding on the front door began. Her husband had already left for work, and she was home with her two children in their second storey apartment in a suburb of St Louis, Missouri.

When a voice barked through the door, Moreland realised the figures outside were police officers.

"He said, 'You need to open up the door or we're going to kick it down,'" she recalls. "My kids are scared and they're crying...I'm upset and I start crying."

The police arrested Moreland - a 30-year-old home healthcare worker with no criminal history - and she spent the next several days in various jails until she was transferred over the river to St Clair County, Illinois.

"It was scary because I had never been in jail. I never had to be on lockdown," she says. "I literally cried every day. I was trying to wrap my mind around, 'Why am I in here?'"

Moreland was accused of shoplifting, evading police and for trying to run down a police officer with her car.

Several months prior to her arrest, a young couple walked into an Old Navy store in a strip mall in Fairview Heights, Illinois. They shoveled little girls' coats, jeans and pants into bags, some still attached to their hangers, then walked out and got into a maroon Buick LeSabre with nearly $700 (£495) worth of stolen merchandise. A security guard called the police.

Image caption Security camera footage showing the theft at Old Navy

The responding officers from the Fairview Heights Police Department quickly located the car at a traffic signal, and an officer named Drew Rutter got out of his patrol vehicle and approached the driver's side of the Buick on foot.

"The driver and I made eye contact, and I observed her grasp the steering wheel," Rutter later wrote in his report. "Fearing for my life and the safety of others in the area, I immediately drew my department issued duty weapon."

The car lurched past him and another officer, missing Rutter's legs by "inches", and disappeared down the highway.

All the police had was the licence plate number, which was registered to Lashonda Moreland's address. When Officer Rutter looked at Moreland's driver's licence photo, he immediately identified her as the woman who had tried to run him over.

Moreland didn't own a Buick, nor did she do her shopping 30 minutes away in a completely different state. She did, however, have a cousin who had registered his maroon Buick LeSabre to her address without telling her. She explained all this to the Fairview Heights police when they first contacted her after the incident, but they didn't believe her.

Things looked bad for Moreland. She couldn't prove her alibi and the witness who placed her at the scene was an officer of the law. She was facing up to 11 years in prison.

Instead of getting dragged through a jury trial, something surprising happened. Moreland's lawyer Kristi Flint told the St Clair County state's attorney office that her client was innocent. In response, the prosecutor offered Moreland the chance to take a polygraph test. Flint nervously agreed, and Moreland passed. Six months after her arrest, the charges were dropped. Everyone, including the Fairview Heights police department, agrees that Moreland is innocent.

Image caption Lashonda Moreland explains to police that she doesn't own a Buick

Moreland did not know it at the time, but she was the beneficiary of a new programme created by St Clair County State's Attorney Brendan Kelly: the Actual Innocence Claim Policy and Protocol. It is a unique, pre-conviction intervention which attempts to prevent the "actually innocent" from going through a trial, taking a plea deal, or ending up in prison.

Actual innocence is a legal concept which means, simply, that a defendant did not commit the crime of which he or she is accused. It is usually invoked when a prison inmate is attempting to appeal his sentence, but Kelly wanted to bring the spirit of the concept to the pre-conviction level.

"That's distinct from 'I didn't get treated fairly'," says Kelly, a Navy veteran who became the county's top law enforcement officer in 2010 when he was only 34 years old. "It's not, 'Some of the evidence was obtained unlawfully, there was an incorrect ruling by the court, on the trial level some error by the defense' - no, you actually have the wrong person here...they're actually innocent."

Since Kelly implemented the policy two years ago, nine defendants - including Lashonda Moreland - have had their charges dropped before trial. Those cases include a reckless homicide by vehicle, four armed robberies and one murder.

To the best of his knowledge, no other prosecutor in the country is attempting anything quite like it. Even the US Department of Justice has taken an interest in what is happening in St Clair County.

"I think it is a nightmare scenario for any prosecutor or any police officer to have investigated and prosecuted and convicted the wrong person," says Kelly. "That strikes at our very sense of what our job is all about, which is to seek justice."

Image caption St Clair County state's attorney Brendan Kelly

There is an increasing body of evidence that suggests that local prosecutors had an enormous hand in the explosion of the US prison population.

Theirs is an incredibly powerful position in the American criminal justice system, though the job is not well understood by the general public. Popular works of true crime journalism like Netflix's Making a Murderer and the podcast Serial are beginning to change that, and cast the prosecutors in each case in a fairly villainous light.

"Between 1994 and 2008, the main cause of rising prison populations is DAs [district attorneys] filing felony cases. This seems to be true across the United States," says John Pfaff, a professor at Fordham Law School. "DAs have kind of managed to avoid a lot of attention for a long time."

Simply put, prosecutors decide what crimes to charge defendants with. A single crime can have a smorgasbord of potential charging options for prosecutors, ones that can come with short or extremely long mandatory minimum sentences. In the "tough on crime" era of the late 1990s, prosecutors started bringing harsher charges more often. Since the vast majority of cases settle with a plea deal, those charges and their sentences stick, meaning prosecutors essentially dictate how much time a person will serve. Only a tiny number of defendants go to trial to challenge the prosecutor.

"District attorneys have almost unfettered discretion on who to charge and who not to charge," says Pfaff. "There's almost no judicial review of what kind of charges you choose, as long as the facts are there to back them up."

The introduction of DNA evidence was a game changer in terms of public awareness of the choices prosecutors make. Suddenly, inmates who'd served decades in prison or been sentenced to the death were able to prove they were innocent. There have been 1,773 exonerations in the US since 1989.

Image copyright Getty Images Image caption Marchers at an anti-mass incarceration rally

This has shone a new light on hard-charging prosecutors who fought for the convictions in the first place, and then sometimes opposed the inmates' bid for freedom, even after DNA evidence contradicted their theory of the crime.

"I think because of some of the professional incentives to get convictions and maintain convictions, and political incentives to be tough on crime, the justice role takes a back seat to the advocacy role," says Northeastern University law professor Daniel Medwed, author of Prosecution Complex: America's Race to Convict and Its Impact on the Innocent.

"It's a little bit of human nature. Once you've made a decision to do something, it often takes a lot of countervailing evidence to get them to change their minds."

But not all prosecutors have buried their heads in the sand when it comes to cases of actual innocence. In the last five years, the number of prosecutors who created so-called "conviction integrity units", or "a division of a prosecutorial office that works to prevent, identify and correct false convictions", have quadrupled. Some have set up screening committees to vet certain types of cases, like a prosecutor in New York state who decided that any case that relied on single eyewitness identification automatically warrants special attention.

Media playback is unsupported on your device Media caption Why are so many Americans behind bars?

However, most remedies become available after defendants have already spent a significant amount of time behind bars. That was the conclusion of Jim Piper, first assistant state's attorney for St Clair County, when he found himself listening to a radio story about the highly lauded conviction integrity unit in Brooklyn, New York, while getting the oil in his car changed one day in 2013.

"So many cases had been overturned where young men had been sitting in jail for years and years before someone got around to vetting the prosecution," he recalls. "It occurred to me - why are we doing that at the end? Why don't we have a procedure in place on the front end to vet prosecutions before they can become a conviction?"

St Clair County is an interesting laboratory for such an experiment. A county with a population of about 280,000, it encompasses the city of East St Louis, which at one time led the nation with its murder rate and has struggled since the 1970s with joblessness, drugs and violent crime. There are 32 arresting agencies of all sizes within the county - from a single part-time officer in Summerfield to the 1,700-officer Illinois State Police - who police everything from the urban industrial riverfront on the western border to the corn fields on the eastern edge. It has its share of official corruption. Kelly has charged 13 police officers in the county with various crimes, everything from theft of evidence to battering a suspect to forcing a woman to perform oral sex at a traffic stop.

"We have every kind of case you can think of," says Kelly, who grew up in the area.

"It was very stressful when I was locked up. I didn't know when I was coming home. Brandon Jackson, 19, exoneree

Around the time that Piper was getting that fateful oil change, the St Clair County state's attorney had three cases on his plate where defence lawyers genuinely believed their clients could be innocent. This is an anomaly - typically, defendants will challenge evidence, or request a lesser charge, but few claim to be actually innocent.

In response, Kelly and Piper authored a simple protocol: If a defendant, their counsel or anyone else associated with the case brought forward compelling reasons to believe that the defendant was innocent, the defendant would be allowed to take a polygraph or a voice-stress test. Piper says that though they know these kinds of tests can be unreliable, being confronted with the chance to take one can filter out disingenuous defendants. Regardless of the results of the test - which are inadmissible at trial due to issues with the reliability of the technology - the assistant state's attorney (ASA) in charge of the case would also perform a "de novo" or "from the beginning" review of all the evidence.

"The ASA shall confirm that no other probative forensic testing can be conducted and that no other witnesses can be identified and interviewed," the protocol reads. "At the end of this review, if both the ASA and supervising ASA(s) either no longer believe there exists a moral certainty of the defendant's guilt or believe there no longer exists a reasonable likelihood of conviction, then the case shall be dismissed without prejudice."

One of the first tests of the programme was a murder case. Rodney Lewis admitted he stabbed 18-year-old Michael Barton Jr, but always maintained that it was in self defence. He passed his polygraph, and after re-examining the evidence, the assistant state's attorney dropped the charges. After 414 days in the St Clair County jail, he went home.

"I think it was his mother who went and picked him up," says Lewis' lawyer, Thomas Keefe III. "She was very, very happy."

Image copyright Getty Images Image caption There have been 1,773 exonerations in the US since 1989

Each of the nine cases has a different set of circumstances that led to charges being filed and ultimately dropped. Eyewitnesses identified the wrong perpetrators. Co-defendants implicated friends or acquaintances who were never there. In one case of an armed robbery of a mobile phone, the defendant falsely confessed after he says he was pressured by investigators.

"I thought I was going to jail anyway, so, I just said I did it," he told the Belleville-News Democrat, which broke the news of the programme. "But I didn't know anything about it."

So far, Kelly says just one claim that was investigated under the protocol actually yielded more evidence of the defendants' guilt, bolstering the state's case - a natural check, he believes, on the programme being abused.

Some have pointed out that vetting cases before trial is a basic tenet of the work of a prosecutor, that Kelly's protocol just codifies what he is supposed to be doing anyway. If that's the case, the revolutionary step seems to be a simple willingness to publicly admit defendants were charged erroneously.

"I was honestly kind of surprised that they came forward and said, 'We dumped these [cases] because of actual innocence,'" says Cathy MacElroy, a defence lawyer who has had two clients exonerated under the protocol.

Kelly claims there have been no complaints from police about the programme, and he wants people to know that even though officers may initially arrest the wrong person, it is good police work that can correct an error as well.

"It's an imperfect world. We have good people in law enforcement and good people in the criminal justice system and good people as witnesses, but they can all make mistakes."

My question is, OK, so what do we do after this? What is he doing with this information? Lashonda is out money, the stresses that she went through - there's no making her whole." Kristi Flint, St Louis defence lawyer

In 19-year-old Brandon Jackson's case, it was the work of defence lawyers that ultimately cleared him. Another teenager implicated Jackson in a plot to lure a tattoo artist who made house calls to an abandoned home, and rob him of his money and equipment. When two of the perpetrators eventually took plea deals, they independently admitted that Jackson had nothing to do with the robbery.

Still, Jackson - and other wrongfully charged individuals - has a hard time feeling grateful. He was 17 at the time of his arrest, and after spending months both in a juvenile detention centre then on house arrest, he couldn't graduate from high school. Now he lives at home with his mother and works in a warehouse.

"It was very stressful when I was locked up. I didn't know when I was coming home. When you get arrested for nothing, you don't know what is going on. Then they're offering you years of your life for nothing," he says. "It took a whole year off my life."

More from the BBC on US criminal justice

Why does Wisconsin send so many black people to jail? - The state that locks up the highest percentage of black men

The US inmates charged per night in jail - Reversing a widespread practice known as "pay to stay"

Why is it so hard to hire black police officers? - One department's effort to diversify

Then there's the fact that he had to pay the county $5 per day while he was on an ankle monitor, plus the cost of a landline to carry the monitor's signal. For his mother Ommie, a double amputee who lives on a fixed income, these were not trivial expenses, nor was hiring a private attorney. She says they're still paying their legal bill in instalments.

Detavius McGary, who was accused of and then exonerated of charges that he robbed an elderly woman at gunpoint, spent 75 days in jail, then also had to pay a per diem fee for a year of ankle monitoring. His mother says she knows her son was lucky to have the chance to prove his innocence, but that she is now "completely broke". McGary says he wanted to sue the county but can't find a lawyer to take the case. And there were other costs.

"When they had me, I couldn't really see my kids," McGary says. "I had so many good job opportunities, [but] then people, they weren't accepting me because of the case. I ain't really all the way recovered."

Moreland's landlord attempted to evict her family over the arrest, until her defence lawyer Kristi Flint wrote a letter explaining the situation. Flint says that clients like Moreland are lucky that they could afford to bond out - a more indigent client who is actually innocent might have just pleaded guilty in order to get out of jail. Six of the nine defendants spent over a month in jail - the longest was Lewis' 414 days.

"I think that it is admirable that Brendan has put this out here as, 'Yes, innocent people get charged and when they do, you know, we dismiss it,'" says Flint. "But my question is, OK, so what do we do after this? What is he doing with this information? Lashonda is out money, the stresses that she went through - there's no making her whole."

Image caption Moreland and Kristi Flint, the lawyer who fought successfully to prove Moreland's innocence

In his cluttered office on the second floor of the St Clair County courthouse - a map of East St Louis with violent crimes, usually gun violence, marked with red stickers in one corner - Kelly admits that his protocol is an experiment, one he can't guarantee will be successful.

"I think we're going to review it every year and just see how it's going. The public defenders, the prosecutors are in the trenches every day and we get continuous feedback," he says.

Currently, the St Clair County state's attorney's office is looking at two new possible cases of actual innocence - this time cases of alleged sexual abuse of a child.

Kelly does not think being open to admitting law enforcement mistakes makes him soft on crime. He considers himself an "aggressive" prosecutor who believes in law enforcement and its role in bringing about the precipitous decline in crime in the US since the 1990s. In his first year in office, he doubled the number of charges filed, though he sent many of those cases to drug and mental health courts. It's a line he says he walks because he believes there is no "criminal justice without social justice".

"Your local DA is accountable not to some person who appointed them in DC, or some state capitol somewhere, but is accountable to the people that they serve," he says. "I think the prosecutor has the ability to be uniquely part of the solution, because again, we're the one entity whose duty is first and foremost to justice."

Subscribe to the BBC News Magazine's email newsletter to get articles sent to your inbox.