A 12-year-old boy who punched a woman and other children and robbed a young girl has avoided a custodial sentence.

The boy, who cannot be named for legal reasons, was sentenced by magistrates in York on Tuesday after he pleaded guilty to three assaults and a robbery.

Sandra White, prosecuting, said the most serious offence was a robbery in which he stole a mobile phone from a young girl, who was known to him and had previously allowed him to use the phone. On September 21 last year, he chased her and tried to snatch her phone, before grabbing her arm, squeezing her rib, punching her and taking the phone.

The boy also punched another boy, about the same age, in the face during an argument on November 17 last year, then met him again later in the day, apologised, then punched him again. The victim was taken to hospital, where doctors had to place him under general anaesthetic and manipulate his septum back into place.

The second incident involved an argument with a female care worker on February 16, where he allegedly head-butted the woman, leaving her with a swollen nose.

On February 22, the court heard the boy had allegedly punched a young girl in Blake Street, though the boy claimed he only pushed her.

Meghan Waldron, mitigating, said there was "a correlation in how the boy is feeling and when these offences occur", and his offences were committed during a period of transition from living at home to living in care. She said his offending behaviour coincided with great upheaval in his life.

"Living with strangers and rules and regulations that weren't in place previously is not an easy move and has not been easy since he's been there."

He told magistrates he felt "bad" about his actions, and when asked whether he would act the same way again, he said: "No. Because it's not worth it. I was going through a hard time when all this started."

Chair of the magistrates, Pauline Wilkinson, said: "Looking at the number and timing and at your past record, we do deem you to be a persistent young offender and this does mean it would be possible for you to go into custody. But we are going to sentence you to a 12-month Youth Rehabilitation Order and general intensive supervision and surveillance as a direct alternative to custody.

"This is a direct alternative to custody and breaching it will have very serious effect. You will be back into court and it is on the court records what has been said today. There is a lot of work and you must keep each and every appointment."

The boy will be electronically tagged and subject to a three-month curfew, and magistrates ordered £200 compensation be paid to the victim who had his nose reset, which will be paid by the local authority.