An Ohio judge Sunday sentenced two teenage boys to at least a year in a juvenile prison after finding them guilty of raping a 16-year-old classmate in a closely watched trial that hinged on text messages, tweets and pictures shared online and among the defendants and their friends.

Judge Thomas Lipps’ sentence means Ma’Lik Richmond, 16, and Trent Mays, 17, could remain imprisoned until they turn 21. Mays, who was also convicted of using nudity-oriented material involving a minor, for having pictures of the girl on his cellphone, was sentenced to an additional year in detention.

Relatives and family members, and the defendants, appealed for leniency.

“I’m aware that this is the first time they have been in trouble with the law, but these are serious charges,” Lipps said in announcing his sentence. He noted that had they been charged as adults rather than in juvenile court, they would have been spending “many years” in an adult prison.

Both boys apologized. “I would truly like to apologize,” Mays said. “No pictures should have been sent around, let alone have been taken.”

Richmond broke down sobbing as he tried to speak. “I would like to say I had no intentions to do anything like that,” he said.

Both boys wept and hugged relatives in the courtroom before being taken into custody to begin serving their sentences.

Immediately after the verdict, Ohio Attorney General Mike DeWine said he will convene a grand jury next month to investigate whether anyone else should be charged. Noting that 16 people refused to talk, many of them underage, DeWine said possible offenses to be investigated include failure to report a crime.

“This community desperately needs to have this behind them, but this community also desperately needs to know justice was done and that no stone was left unturned,” he said.

The case captured national attention by touching on issues beyond the criminal accusations. Women’s groups said the behavior of witnesses who took pictures of what was happening and joked about the “rape” of a “dead girl” was symptomatic of a misogynistic attitude allowed to flourish in Steubenville, Ohio, and elsewhere.

Some compared the girl’s treatment to that of a 23-year-old woman in India who died after being gang-raped on a bus and tossed into the street last December — about the same time the Steubenville case began attracting national attention.

Outsiders, and some community leaders, lamented the absence of parental guidance and questioned why 16- and 17-year-olds were allowed to drift from one booze-filled party to another throughout the night of Aug. 11 until the next morning.

Without social media, the case might never have come to court. The girl, who said she did not remember what had happened, learned about it after becoming aware of online chatter and pictures. She and her parents went to police on Aug. 14, and Mays and Richmond were arrested eight days later.

The verdict followed days of graphic testimony and eyewitness recollections portraying a night of high school parties that turned ugly, for the girl at the center of the case and eventually for the boys who chronicled the events via text messages, pictures and videos and who later tried, futilely, to erase the communications.

Those online exchanges were key to the prosecution and revealed an indifferent attitude toward the girl as she became so intoxicated that she could barely speak or walk. She vomited repeatedly, once while sitting half-naked in the middle of the street, several witnesses said.

The text messages also raised questions about whether the head coach of the Steubenville High School football team, Reno Saccoccia, tried to quash the accusations to protect his players. The football team has 27 coaches, many of them volunteers.

Joann Gibb, an agent with the Ohio Bureau of Criminal Investigation who was responsible for examining students’ cellphones and retrieving data from them, testified that Mays texted a friend and told him that Saccoccia “took care of it.” “Like he was joking about it so I’m not worried,” Mays added.

Other messages Mays sent from his phone indicated an attempt to craft a story of what had occurred as pictures, tweets and videos from the night circulated online.

“Just say she came to your house and passed out,” he wrote to one friend whose home was where the girl ended up, naked and motionless on the floor with both defendants performing sexual acts on her.

Two witnesses, friends of the defendants, said they saw both defendants sexually assault the girl and used their cellphones to capture images of it. They were among three eyewitnesses granted immunity from prosecution in exchange for testifying, a decision that angered victims’ advocates, who said witnesses should have been charged with failing to report a crime.

The girl, who lives a few miles away in Weirton, W.Va., was described as becoming extremely intoxicated very quickly as she downed vodka drinks.

— The Associated Press contributed to this report