Michael Ward (left), 18, and Kenneth Williams, 20, are charged with murder in the death of Hadiya Pendleton, 15, of Chicago. Pendleton was shot to death Jan. 29 in a park about a mile from President Barack Obama's home on Chicago's South Side. (ASSOCIATED PRESS / Chicago Police Department)

CHICAGO (AP) — Two men circled a park on Chicago’s South Side looking for members of a rival gang before one crept up on a group seeking shelter from the rain under a canopy and opened fire, striking a 15-year-old honor student who once made a video protesting gang violence, prosecutors said Tuesday.

New details about the death of Hadiya Pendleton emerged during a court hearing in which a judge denied bail for the two men charged with murder in her death, 18-year-old Michael Ward and 20-year-old Kenneth Williams.

Williams’ attorney denied that his client was a gang member, but Cook County Assistant State’s Attorney Jennifer Sexton laid out in sometimes chilling detail — much of it, she said, provided by the defendants themselves — of a hunt for rival gang members that ended with a deadly case of mistaken identity.

Authorities have said no one in Pendleton’s group was affiliated with a gang. Her death is one of dozens of homicides in Chicago already this year but has drawn national attention in part because the drum majorette performed as President Barack Obama’s inaugural festivities just days before the shooting.

Sexton said Ward and Williams belonged to the SUWU gang and were trolling the streets about a mile from Obama’s Chicago home on Jan. 29, looking for members of a rival 4-6 Terror gang. They saw Pendleton and her friends huddled under the canopy about 2 p.m., mistook them for members of the other gang and pulled over in an alley, she said.

Ward told police the two gangs had been shooting at each other since 2010, and he was angry with the 4-6 Terror gang for shooting and killing a friend of his, Sexton said. He hopped out of the car and was handed a gun by Williams, who police said had been shot in the arm by a member of a rival gang just six months earlier, she said.

“Defendant Ward admitted he snuck up on the group and they didn’t see him coming,” Sexton said. He fired at least six times, she told the judge. One bullet struck a 17-year-old in the left ankle, and another grazed the left foot of another 17-year-old.

Pendleton was hit in the upper back.

“She was able to make it outside of the park and then collapsed on the street,” Sexton said. The teen died later that day.

Ward ran back to the car, where Williams was waiting, and the two drove off, the prosecutor said. Police tied the two to the shooting with cellphone records that placed Williams near the park at the time, and surveillance video showing Ward’s mother’s white Nissan driving back and forth by the park.

Ward admitted his role in the shooting to police in videotaped interviews, and Williams confessed “to a third party witness,” State’s Attorney Anita Alvarez said later. She did not elaborate.

Pendleton’s slaying has drawn national attention, in part because of its proximity to Obama’s home and in part because the teen had performed during inauguration festivities. First lady Michelle Obama attended the girl’s funeral Saturday, and Pendleton’s parents were to join the first lady on Tuesday to listen to the president’s State of the Union address, in which he is expected to talk about gun violence.

But although Pendleton has become a symbol of the cost of gun and gang violence, authorities said it also was a just a case of mistaken identity.

“Defendant Ward admitted that the girl, now known as Hadiya Pendleton, had nothing to do with it,” Sexton said in court. “She was just there.”

Attorneys for the two suspects did not speak much at the hearing but talked to reporters afterward.

Ward’s attorney, Jeff Granich, suggested Ward is a victim of the intense national attention the case received and pressure to close the case.

“The problem when criminal cases get made into political cases ... rules are bent and mistakes are made,” he said. Ward, he said, asked repeatedly for 48 hours to speak to an attorney but “during that time those requests were ignored by the Chicago Police Department.”

Williams’ attorney, Matthew McQuaid, said Williams was not a gang member and he doubted any admission of guilt.

“The question of whether Mr. Williams made any kind of statement, I think, is in question,” said McQuaid, who described his client as a high school graduate who lives with his family and works at an air courier service at Chicago’s O’Hare International Airport.

Williams’ only run-in the law was on a retail theft charge “for which he received supervision,” McQuaid said.