Pope Francis shakes hands with an inmate in a Philadelphia jail on Sunday. (Pool photo by L'Osservatore Romano via AP)

Sometimes, you can get an audience with the pope sooner than you can get your day in court.

Prosecutors charged Farris Ravenell with robbery in 2009. Five years passed before the case reached trial, and after two days of testimony, a jury acquitted him. Meanwhile, Ravenell was arrested on suspicion of punching a bus driver in the face. That case, which began in 2013, is pending.

Ravenell maintains he's innocent of striking the driver. The state says his aggression endangered passengers on the bus and in other vehicles on the road. A jury hasn't heard the case, but already, Ravenell has effectively served a two-year sentence for a crime in which there were no serious injuries.

All in all, Ravenell has spent most of the past six years awaiting trial, and most of the past two years in Curran-Fromhold Correctional Facility, a Philadelphia jail, where he was one of a group of inmates who met with Pope Francis on Sunday.

"This time in your life can only have one purpose: to give you a hand in getting back on the right road, to give you a hand to help you rejoin society," Francis told the inmates in brief remarks.

For many inmates, that return to society is long in coming. Ravenell's story shows just how much time it can take the courts to resolve criminal cases in the United States.

His court-appointed lawyer, Damian Sammons, said that delays in scheduling trials are common. There's nothing unusual about a defendant waiting two years to see a jury in Philadelphia, he said.

"The courts are overloaded with cases," Sammons said

Philadelphia received a grant of $150,000 from the MacArthur Foundation earlier this year. The city will use the money to study its courts and jails and to look for ways to resolve cases more efficiently. 

National data suggest that defendants are spending more time waiting in jails before going to court. Researchers at the Vera Institute of Justice estimate that the average inmate spends more than three weeks in jail, compared with just two weeks in 1983.

But these waits often do not receive much attention, particularly because they happen at jails, rather than prisons, where convicted criminals serve time after trial.

"Conditions in jails are typically worse than they are in prisons," said Holly Harris, the executive director of the U.S. Justice Action Network and an advocate for reform met with religious leaders in Philadelphia ahead of the pope's visit to Curran-Fromhold.

[The best way to deal with America’s incarceration problem is hiding in plain sight]

Ravenell, 23, was not detained pending his trial for robbery. Court records show that several dates were set for that trial in 2012, but the court was busy with other cases. Then the attorney initially assigned to his case, an elderly man, fell ill and the trial had to be postponed again. When that lawyer died, Sammons was appointed to the case.

The case was still pending when Ravenell was arrested in connection with the assault on the bus driver. Since he had two cases before the court, prosecutors described him as a danger to society. The court set his bail at $150,000 -- an amount he could never afford. And amid arguments from the prosecutor that the defendant should remain behind bars, the court decided not to offer any bail at all.

Ravenell was let out on house arrest for several weeks this spring, but Sammons said he was arrested again when he stayed out too late, violating the terms of his release.

Like many inmates, Ravenell made an error of judgement, but his story is still illustrative of what critics say is an excessive focus in the criminal justice system on bail. That, they say, is one reason that the average defendant is spending more time in jail. Sammons argued that bail discriminates against those who can't pay.

[$500,000 bail for a Baltimore protester? Just one thing wrong with how we punish people before they’re convicted.]

"You're innocent until you're proven guilty, but unfortunately, in our criminal-justice system, it's not geared toward people who are poor," he said. "Most people don't have the ability to pay the exorbitant bails."

Sammons intends to present an alibi at Ravenell's trial, which is scheduled for December.

According to Sammons, of the 19 people on the bus that day in 2013, only the driver identified Ravenell as the culprit. Ravenell was arrested eight months after the incident.

Ravenell's father is a retired police officer, and several of his cousins and his sister's fiance are cops, too. His mother is a pastor at Philadelphia's Gilead Praise & Worship Center, an Apostolic church, who wears her husband's badge around her neck wherever she goes.

"I raised my family up in the Lord," Elaine Ravenell said. "I brought all my children up the right way."

All the same, Elaine Ravenell said, her son was running with the wrong crew.

"Sometimes, you can be in the wrong place at the wrong time," she said. "He didn't do it, but it was very, very hard on my family, because it took over five years for us to finally get to court."

She doesn't fault the police, though. "They have to try to get the people that committed the crime," she said.

"It's dangerous out there," she added. "Some people, they act crazy."

When her son is released, she said he's committed to going back to school at a community college, going to work and staying out of situations where trouble might come looking for him.

She said she hopes Farris Ravenell's meeting with Francis will be "something he can hold onto." She hasn't talked to her son yet but recorded the audience and the pope's speech at the jail, which were broadcast on television Sunday.