Chardon, Ohio (CNN) -- Prosecutor David Joyce said Tuesday that 17-year-old T.J. Lane has admitted taking a .22-caliber gun and a knife into Chardon High School on Monday morning and firing 10 rounds, choosing his victims randomly.
Asked by Judge Timothy J. Grendell during a preliminary hearing if he understood his rights, Lane said softly, "Yes, sir, yes, I do."
Lane will continue to be held in detention, and charges must be filed by 4:45 p.m. March 1, the judge ordered.
Joyce predicted Lane will be tried as an adult. "Absolutely," he said. "It's a matter of law in the state of Ohio. At 17 years old, committing an act like this." He predicted the high school sophomore will be charged with three counts of aggravated murder "as well as other counts."
"I guarantee that this was an aberration, this does not represent our community," Joyce told reporters. "He chose his victims at random. This is not about bullying. This is not about drugs. This is someone who is not well and I'm sure, in our court case, we will prove that to all of your desires and we will make sure that justice is done in our county."
Grendell said the court had tentatively scheduled a hearing for March 19 "should there be a filing of a motion for transfer to the adult court."
Earlier Tuesday, a third student died of wounds suffered in the shooting, hospital officials said.
Demetrius Hewlin died Tuesday morning, MetroHealth Medical Center said in a statement.
Russell King Jr., 17, was declared brain dead early Tuesday, according to the Cuyahoga County medical examiner's office.
Student Daniel Parmertor died Monday.
"We are very saddened by the loss of our son and others in our Chardon community," Hewlin's family said in a statement released by the hospital. "Demetrius was a happy young man who loved life and his family and friends. We will miss him very much, but we are proud that he will be able to help others through organ donation."
Police Chief Tim McKenna said the motive remained unclear. Students have described Lane as a withdrawn boy.
Lane told authorities that he stole the gun used in the shootings from his uncle, a source told CNN on Tuesday.
A law enforcement source said the weapon had been purchased legally.
Police found the gun inside the school, apparently dropped by the suspect as he fled, the source said.
One other student wounded in the shooting remained hospitalized Tuesday. A fifth victim was released, officials said.
Geauga County Sheriff Daniel McClelland said the community has a long way to go before it can put the shooting behind it.
"Now we move to another important phase," he said. "And while the investigation continues and we still look for the why and what and who, we now deal with a community looking to heal."
A prayer service at the Church of St. Mary in Chardon sought to speed that healing. Hundreds of people spilled outside the front of the church. Inside, those assembled applauded as school and police officials were introduced.
"These are great people and out of a very, very, very terrible tragedy, they'll rise again and they'll make this an even greater town," Gov. John Kasich told reporters outside the church.
Heather Weinrich, a 2004 graduate of the school, said she drove an hour with her elementary school-age son to attend the event because she wanted him to know what happened and she wanted to support her school.
Zack Barry, an 18-year-old senior at the school, said he was overwhelmed by the turnout of support. "It made me feel very good," he said.
Classes in the tightly knit community of 5,100, about 30 miles east of Cleveland near Lake Erie, are to resume Friday. But staff, students and parents will be encouraged to return to district schools for visits and counseling on Wednesday and Thursday, Superintendent Joe Bergant said.
Some of the victims were students who were in the cafeteria waiting for a bus to take them to Auburn Career Center, a nearby vocational school that they attended, said Maggie Lynch, the school's superintendent.
Lane is a student at Lake Academy Alternative School, a school for at-risk children, said the school's interim director, Don Ehas.
In a statement Monday, Parmertor's family said they were "torn by the loss."
"Danny was a bright young boy who had a bright future ahead of him," the family said.
Lawyer Bob Farinacci, speaking for Lane's family, said Monday night that the suspect was "extremely remorseful."
"Very, very scared and extremely remorseful," he told CNN affiliate WKYC.
"He is a very confused young man right now," Farinacci said. "He's very confused. He is very upset. He's very distraught."
Like others in Chardon, Lane's family also has been left groping for an explanation.
"This is something that could never have been predicted," Farinacci said. "T.J.'s family has asked for some privacy while they try to understand how such a tragedy could have occurred and while they mourn this terrible loss for their community."
With little to go on to help make sense of the violence, many turned to cryptic Facebook postings by the alleged shooter for a glimpse into Lane's mindset -- especially a long, dark poetic rant from December 30.
The post refers to "a quaint lonely town, (where there) sits a man with a frown (who) longed for only one thing, the world to bow at his feet."
"He was better than the rest, all those ones he detests, within their castles, so vain," he wrote.
Lane then wrote about going through "the castle ... like an ominous breeze through the trees," past guards -- all leading up to the post's dramatic conclusion.
"Feel death, not just mocking you. Not just stalking you but inside of you," it says. "Wriggle and writhe. Feel smaller beneath my might. Seizure in the Pestilence that is my scythe."
The post concludes with: "Die, all of you."
Farinacci said Lane was a "fairly quiet and good kid" with good grades who was doubling up on classes to graduate in May.
"He pretty much sticks to himself but does have some friends and has never been in trouble over anything that we know about," he said.
But just before class started Monday, witnesses say, Lane silently walked up to a table of students, holding a gun. As he opened fire, the shooter was expressionless, a student recalled.
"He was silent the entire time," said student Nate Mueller, who said his ear was grazed by a bullet. "There was no warning or anything. He just opened fire."
Monday's death toll might have been higher had it not been for the actions of assistant football coach and study hall teacher Frank Hall. Students said Hall chased the gunman out of the school, and police arrested the suspect nearby a short time later.
"Coach Hall, he always talks about how much he cares about us students, his team and everyone," said student Neil Thomas. "And I think today he really went out and he proved how much he cared about us. He would take a bullet for us."
Similar praise was given to math teacher Joseph Ricci, whom 10th-grader Kaylee O'Donnell said made sure his students were safe before donning a bulletproof vest and entering a hallway, where he pulled a wounded student inside. "You're pretty brave in risking your life for students," she said.
"I actually was sitting with a girl, and she asked if we could pray and I'm like 'Yes, please.' So me and her quietly did that and a couple of my friends."
Asked how she would feel when she returns to school, she said, "It's not going to be the same, but I still feel safe."
The shooting has had national repercussions. "Violence like this should not be tolerated in our society," said House Speaker John Boehner. "But let's be honest -- there are about 250 million guns in America. They are out there but people should use them responsibly."
CNN's Scott Thompson, Laura Dolan, Lateef Mungin, Martin Savidge, Lisa Sylvester and Susan Candiotti contributed to this report.