SAN JOSE — Two former San Jose State University students were sentenced Monday morning to 30 days in jail or weekend work for battering an African-American suitemate in their campus dormitory, while a third former student was put on probation.

The punishment fell short of the 120 days in jail that prosecutors had sought in the controversial bullying case that roiled the university campus, spurring allegations of race-based harassment. The three men were acquitted of hate crime charges.

“This was not simply a prank, according to the jury,” Santa Clara County Superior Court Judge Thang Nguyen Barrett told defendants Colin Warren and Logan Beaschler. “You have committed a crime.”

Warren and Beaschler are eligible to do weekend work in their home counties and will have to serve only half their sentences. Each must also do 50 hours of volunteer work with a nonprofit organization serving the black community and enroll in a cultural awareness program on the African-American experience or the black civil rights movement.

Co-defendant Joseph “Brett” Bomgardner was sentenced to one day in jail, but will get credit for time served, and was spared weekend duty. Like Warren and Beaschler, he must do 50 hours of volunteer work and take a sensitivity class.

The three men are in their early 20s. A fourth student in the case was 17 at the time and was charged as a juvenile offender. The court system keeps juvenile prosecutions confidential.

Last month, a jury of six men and women — none of them African-Americans — found the three men guilty of misdemeanor battery on Donald Williams Jr., a black student who shared the same dormitory suite. In the worst incident, some of the defendants clamped a U-shaped bicycle lock around Williams’ neck.

At the same time, the jury did not buy the prosecution’s argument that the former students committed more serious hate crimes, including the displaying of a Confederate battle flag by Beaschler in the dormitory suite.

Several of Williams’ family members and supporters attended the sentencing and listened intently as deputy district attorney Carolyn Malinsky and defense attorneys jousted over the sentences. Williams’ mother read a statement asking the judge to side with the prosecution.

“Unfortunately, we are not shocked,” Nancy Williams said of the defendants’ acquittal last month on hate crime charges. “We are convinced it was because of his innate difference.”

Warren, given a chance to address the court, apologized to the family of Donald Williams. The victim did not attend the hearing.

“I am truly sorry that any of this happened,” he said. “It was certainly insensitive and offensive, but it wasn’t racially motivated.”

During the trial, the prosecutor tried to convince the jury that the defendants had singled out Williams because he was black. The defense lawyers countered by portraying the incidents as college pranks.

he Williams family left the courthouse quietly Monday without commenting to news reporters. But Carl Douglas, Williams’ civil attorney, best known as one of O.J. Simpson ‘s lawyers in the former football star’s murder trial, said: “This judge is sending a message condemning racism in young impressionable minds. This sentence better reflects the offending conduct than the verdict.”

Williams is suing the university and the young men for $5 million.

Attorney Chuck Mesirow, who defended Beaschler, said the judge’s sentences were appropriate, partly because the defendants have already been banned from the California State University system for life.

“I think it was a fair compromise,” Mesirow said. “(Beaschler) has suffered, too. They’ve all suffered, and their families have suffered. It’s enough.”

San Jose State interim President Sue Martin responded to the sentencing with a statement focused on the university’s desire to put racial troubles behind.

“We respect the district attorney’s and the court’s discretion in considering appropriate sanctions based on the defendants’ conduct,” she said. “That notwithstanding, the behavior described in this case is unacceptable, and SJSU is committed to a welcoming and inclusive environment for all students.”

As the case garnered widespread attention, the university started looking for a “chief diversity officer” and appointed a search committee headed by LaDoris Cordell, a retired judge and prominent civil rights activist. Cordell said Monday she was disappointed by the sentences Barrett imposed.

“In my view, the sentence was appropriate for a simple battery case, but this was not a simple battery, given the racial tinge to the crimes and the harm that was caused to the defendant,” Cordell said. “I think that the 120-day sentence that the DA sought would have sent a far stronger message to the defendants and to the community.”

Malinsky politely sidestepped questions from reporters who asked after the hearing if justice was served. When asked why the judge would require the three men to study up on the black experience after the jury had thrown out the hate crime charges, the prosecutor said, “The judge’s decision speaks for itself.”