A 7-yo girl has been assaulted in a toilet before a man was stabbed trying to save her.

A man has been arrested after he allegedly sexually assaulted a child in a toilet at a Sydney dance studio and stabbed another man who came to the girl’s aid.

It’s believed the 54-year-old man assaulted the seven-year-old girl in the studio’s toilet on Railway Parade in Kogarah on Thursday night.

A 46-year-old man who confronted the alleged offender was stabbed in the abdomen and neck during a struggle.

Bystanders came to the injured man’s aid and detained the offender until police arrived.

The 46-year-old man was taken to St George Hospital in a stable condition. The girl was taken to Sydney Children’s Hospital for observation.

The 54-year-old was arrested and taken to hospital with facial swelling and bruising. He remains under police guard and will be interviewed later on Friday.

Superintendent Julian Griffiths said the man – from Kogarah – was not a staff member or known to the dance studio.

“Investigators have not been able to identify he has any links to those commercial premises and it appears to be a random, isolated incident,” he told reporters in Sydney.