SALT LAKE CITY — A teenager charged with killing a Utah soccer referee because he didn’t like the man’s call during a game pleaded guilty Monday to a charge of homicide by assault in a case that brought new attention to the issue of violence and sportsmanship in athletics.

The plea deal was hashed out between the teen’s attorneys and prosecutors as the judge planned to hear testimony to decide if the 17-year-old suspect would be tried in juvenile or adult court. Under the deal, prosecutors agreed to keep the case in juvenile court.

A judge sentenced the teenager to juvenile prison, leaving how much time he’ll spend there up to a juvenile parole board. The maximum would be just more than three years, until he turns 21, but the parole board has the authority to let him out sooner, said Patricia Cassell, a Salt Lake County deputy district attorney.

Police say the teenager punched 46-year-old Ricardo Portillo once in the head on April 27 after the referee called a foul on him. Portillo died after a weeklong coma, leaving behind three daughters.

The count of homicide by assault is issued when an attack unintentionally causes death.

“I was frustrated at the ref and caused his death,” the teenager said softly, when Juvenile Court Judge Kimberly Hornak asked him what happened.

Hornak ordered him to put up a picture in his cell of Portillo and write his daughters a letter every week about how he’s improving himself, so that he’s reminded constantly of the pain he caused the family.

The AP is withholding the teen’s name because of his age.