A teacher who was allegedly killed by one of her students had asked him to stay after school the day she was killed, a classmate said Thursday, as students met with grief counselors and tried to come to grips with the slaying of the popular teacher.

Philip Chism, 14, was charged with murder Wednesday in the death of Colleen Ritzer, a 24-year-old math teacher at Danvers High School.

Rania Rhaddaoui sat two seats away from Chism in Ritzer’s Algebra I class, the final class of the school day. She said Chism was drawing in a notebook rather than taking notes Tuesday.

“She came over and said, ‘I didn’t know you draw,’ and he said, ‘yes,’ then later on, she said, ‘Can you stay after with me?’ ” Rhaddaoui said. “Obviously, he stayed after because when I was leaving, he was still at his desk.”

She said Ritzer had scheduled a test for Friday, but she was unsure why exactly Ritzer asked Chism to stay after school.

Ritzer never returned home that day. Blood in a second-floor bathroom helped lead investigators to her body, which was dumped in the woods behind the school in a close-knit community about 20 miles north of Boston.

Chism was picked up by police in the early morning hours Wednesday, walking along Route 1 in neighboring Topsfield. His attorney declined to comment outside court Wednesday and did not immediately return a call seeking comment Thursday.

The high school remained closed for classes Thursday, but grief counselors were on hand to offer comfort to students.

Kaitlyn Nash, 16, went to the school to be with her friends. She said students who knew and loved Ritzer were still trying to make sense of what happened. She said she found it particularly frightening that she had theater rehearsal Tuesday afternoon and was at the school when authorities believe Ritzer was killed.

“It’s just terrifying,” she said. “I know a lot of people don’t want to go back to school at this point. I know we have to, and we just need to get on with.”

Classes were expected to resume today.

Authorities offered no clues Thursday about Chism’s alleged motive. They also would not say how Ritzer was killed.

Carrie Kimball-Monahan, a spokeswoman for Essex District Attorney Jonathan Blodgett, said the case was still being investigated.

Chism had moved to Massachusetts from Tennessee before the start of the school year and was a top scorer on the school’s junior varsity soccer team.

Jean McCartin, a Danvers School Committee member, said the school has extensive programs to help ease the transition for new students who may have problems but there was no information about Chism that would have presented any red flags.

“He just presented himself to us like any other student would,” she said Thursday. “And that’s what I think is so hard for the administration right now. You know, their hearts are breaking because they just didn’t know he was in need, if he was in need. … No one knows why he would have behaved in this way and done such a terrible thing.”

Students were also puzzled. Chism’s teammates on the soccer team have said he was soft-spoken and nonviolent.

Rhaddaoui said Chism was quiet, and she never saw him raise his hand in math class. She said they were also in the same history class, where he told classmates he spoke three languages: English, Portuguese and Japanese.

Ritzer was described as an enthusiastic, caring teacher who stood outside her classroom and said hello to all students, whether they were in her classes or not.

Ritzer’s family released a statement Thursday, asking the media to respect their privacy as they make arrangements “to celebrate Colleen’s vibrant life.”

Chism appeared briefly in court Wednesday for arraignment on a murder charge and was ordered held without bail.