OAKLAND — A former Richmond youth soccer coach who pummeled a referee during a game for 8- and 9-year-olds avoided jail time this week when he was sentenced to 30 days of work service and three years' probation.

Mauricio Avila Alvarez, 33, pleaded no contest to two charges of misdemeanor battery Wednesday at the Wiley W. Manuel Courthouse in Oakland.

In addition to work service, Alvarez was ordered to attend anger management classes and write a letter of apology to Alameda-Contra Costa Youth Soccer League referee Bruce Greenlee, who reportedly needed stitches after he was beaten in November.

Alvarez attacked Greenlee during a soccer match after the referee called off a game being played by Alvarez's team, the Richmond Cabritos.

Prosecutors were hoping Alvarez would get a six-month jail sentence, Alameda County Deputy District Attorney Joni Leventis said.

"A lot of the kids felt very frightened by seeing a coach behave in the way he behaved," Leventis said. "I think everybody's impression was that he was not remorseful for what happened."

Leventis said witnesses supplied photos of Alvarez after the attack. In one, he is walking away holding up his middle finger, she said.

A soccer league official said Alvarez has been banned from coaching. It was not clear Thursday whether the ban will be permanent.

League officials said Greenlee, a longtime referee, ended a November match between Alvarez's team and another squad because one of Alvarez's players did not have the proper paperwork showing that he was under 10 years old.

The game was the last of the season. Alvarez reportedly had been warned about using ineligible players. When Alvarez could not prove his goalie was younger than 10, Greenlee ended the game at halftime and handed Alvarez's team a loss.

Alvarez's punishment also includes a $100 fine, an order to stay away from Greenlee and an order to take a basic referee class, court documents show.

Neither Alvarez nor Greenlee could be reached for comment Thursday.