When Philadelphia police shot and killed a homeless man brandishing a utility knife Friday in the concourse near City Hall, it had special meaning for state Supreme Court Justice Seamus P. McCaffery.

Twenty years ago, McCaffery told an audience of Philadelphia court and municipal officials, he was a police sergeant with the subway unit.

"I know what those officers are going through down there dealing with the homeless," McCaffery said. "That's the kind of tragedy that we don't want to happen. These are human beings that we as a society need to step up to the plate and help."

Yesterday McCaffery got that chance, joining Philadelphia court officials to announce the creation of the city's first Mental Health Court.

The court, which begins today with a pilot group of 15 individuals, is to take a group of nonviolent inmates about to complete their jail terms and make sure they have the necessary therapy and supervision lined up to successfully live in the community.

"We want to stop the revolving door of recidivism," said Common Pleas Court Supervising Judge Sheila Woods-Skipper, who will oversee the new program.

Officials at yesterday's announcement at the Criminal Justice Center - including Mayor Nutter and District Attorney Lynne M. Abraham - emphasized that public safety was a criterion for which inmates would qualify.

The program is not for people charged with murder or manslaughter, violent and sex crimes, or gun offenses. A candidate cannot have more than five prior cases resulting in prison sentences. The individuals must also be eligible for Medicaid coverage and have at least a year of court supervision remaining on their sentence.

Nationally, so-called problem-solving courts have become a growing trend since the first handful were created in 1997.

Philadelphia already has several specialized courts, such as Community Court to address minor "quality-of-life crimes" and Drug Court. Both are designed to divert and resolve relatively minor criminal cases and keep them from clogging the city's overburdened courts.

About a dozen Pennsylvania counties have mental-health courts, McCaffery said, but the Philadelphia program is the first geared toward inmates about to reenter society after imprisonment - those most likely to become recidivists.

The idea is to try to address a problem that began building decades ago with the closing of large state mental hospitals without the necessary community-support services to ensure that people with mental illness continued medications and therapy and had the skills to survive in the community.

Untreated mental illness has been identified as a key factor among many people who are homeless and among those for whom prisons have become the new state mental hospitals.

McCaffery estimated that 30 percent of those incarcerated in the Philadelphia prison system were there because of mental illness.

"We can't keep putting people in jail," McCaffery said. "Jail is not the proper place for so many of our citizens. This will save us money, and this as a society is the best thing to do to help people that need it."

One reason the Mental Health Court concept was supported by such diverse parties as prosecutor Abraham and Chief Public Defender Ellen T. Greenlee is that pieces of it have been used for at least two years.

Since 2007, criminal defendants with mental illnesses have had their cases assigned to a single Municipal Court judge who works with prosecution and defense lawyers and court-appointed mental-health experts to ensure those awaiting trial get treatment.

The Mental Health Court extends the concept post-prison.

Abraham said 500 nonviolent defendants had gone through the predecessor program since 2007 and "no one has been a recidivist. That's a very enviable record."

That record is also the reason the program is affordable at a time when the city - and the courts - are in the midst of a financial crisis.

A $60,000 state grant will underwrite start-up costs, but personnel will be drawn from existing probation and mental-health-services agencies.

Woods-Skipper said the current staff could handle about 70 people before personnel would have to be added.

"I'm optimistic that as we move forward resources will be provided," Woods-Skipper said.

The announcement was praised by justice-reform and mental-health advocates.

"This is something we've long been interested in," said Debbie Plotnick, director of advocacy for the Mental Health Association of Southeastern Pennsylvania. Plotnick said the court would complement the recently created police crisis-intervention teams in dealing with mental-health emergencies.

Lynn A. Marks, executive director of Pennsylvanians for Modern Courts, called the court a "shining example of what can happen when leaders of the courts, city administration, criminal justice-related agencies, and the mental-health community collaborate for the common good."

Marks called the program "good for the individual, good for the justice system, and good for our entire Philadelphia community."