Chicago (CNN) -- The teenager who police say shot and killed Chicago honor student Hadiya Pendleton was on probation for unlawful use of a firearm, Police Superintendent Garry McCarthy said Monday night.
Michael Ward, 18, and Kenneth Williams, 20, were each charged with one count of murder and two counts of attempted murder, McCarthy told reporters.
Ward confessed to shooting Hadiya and two others in late January in a case of mistaken identity, McCarthy said.
Police said Ward and Williams were gang members seeking revenge against the people who had shot Williams in July.
"Ward crept on foot, spraying gun fire," McCarthy said.
McCarthy said Ward was sentenced to two years' probation in January 2012 for unlawful use of a firearm.
The charges come 12 days after Hadiya was shot to death at a park in what her godfather, Damon Stuart, described as an "ideal community" on Chicago's South Side.
Her death occurred a week after she performed at one of the events surrounding Obama's second inauguration.
The killing -- which occurred in the city's Hyde Park neighborhood near the Obamas' Chicago home -- drew the first couple's attention.
First lady Michelle Obama attended Hadiya's funeral Saturday, and her husband wrote a note to Hadiya's family that was printed on the funeral program: "We know that no words from us can soothe the pain, but rest assured that we are praying for you, and that we will continue to work as hard as we can to end this senseless violence."
Hadiya, who often urged friends to stay away from gangs, was an honor student and band majorette at King College Prep School.
Her slaying -- the 42nd in the city this year -- also highlighted the problem of gun violence in Chicago. More than 500 people were fatally shot in 2012.