There is no doubt John Wagner, the man convicted of murdering Johns Hopkins researcher Stephen Pitcairn in Baltimore last year, shouldn't have been on the streets that day. Mr. Wagner had a long history of violent crimes and should already have been behind bars. The Baltimore City judge who sentenced him to life plus 20 years Friday made sure he won't soon be free to kill again, and the fact that Mr. Wagner will likely spend the rest of his days in a prison cell provides a measure of justice for the victim's family and friends. But sadly, justice came too late to save Mr. Pitcairn's life.

Mr. Pitcairn's murder was just one of hundreds of homicides in Baltimore in 2010, yet its impact resonated because the victim was a young man with a promising future whose life was taken as he walked to his home in Charles Village while talking with his mother on a cell phone. The killing brought home the senselessness of the city's violence for many people who thought it didn't affect them. It also displayed glaring flaws in a criminal justice system that had failed to protect citizens from society's most dangerous offenders.

Mr. Wagner had a 20-year record of arrests for assault, armed robbery, auto theft and domestic violence, as well as a string of drug convictions. Yet despite the seriousness of his crimes, he managed to get off each time with the equivalent of a slap on the wrist. He spent most of the last two decades out on the streets rather than in jail because he was always able to persuade a judge to give him one more chance.

The case became a political issue in last year's elections when Gregg Bernstein successfully used it in his campaign to unseat longtime City State's Attorney Patricia A. Jessamy by criticizing her failure to keep violent offenders off the streets. But the problems revealed by the Pitcairn killing are rooted not just in the prosecutor's office but throughout a criminal justice system that fills the jails with thousands of people convicted of low-level, nonviolent crimes while allowing violent repeat offenders to go free.

Baltimore has made significant progress in reducing crime in recent years, and City Police Commissioner Frederick H. Bealefeld III's strategy of going after illegal guns and targeting violent offenders appears to be working. But unless police, prosecutors, judges and prison officials find better ways to focus their efforts on the relatively small number of violent offenders who commit most of the city's serious crime, we fear that senseless tragedies like the murder of Stephen Pitcairn will happen again.