A man is under police guard in a Sydney hospital, after he allegedly sexually assaulted a seven-year-old girl and stabbed a man who tried to intervene.

Key points: The accused attacker may not be able to speak with police until next week

The accused attacker may not be able to speak with police until next week Police say he had no link to the dance studio and have called the incident "isolated"

Police say he had no link to the dance studio and have called the incident "isolated" A younger man went to the girl's aid after realising she was missing

Police said the seven-year-old was sexually assaulted at a dance studio in Kogarah about 8:00pm on Thursday.

Her accused attacker, a 54-year-old man, was confronted by a younger man, 46, and a struggle broke out.

Police said the younger man was stabbed in the abdomen and neck before witnesses came to his rescue and detained the attacker.

The older man sustained facial injuries and bruising and was taken to St George Hospital. He remains in a stable condition.

The younger man has received stitches to his wounds and been released from the same hospital.

Rachelle Youssef owns a beauty parlour near the studio.

"I heard terrible screaming — blood-curdling screaming," she said.

Ms Youssef then heard a man yell out for someone to call the police.

"I think a dentist found the girl in the bathroom and then a really brave father went in to defend the child — and a man was stabbed and collapsed on the pavement."

Witness Mohamad Hariri, who was out for a birthday dinner with friends, also heard the screams as a man rushed out of the studio and onto the street.

Kogarah shop owner Mohamad Hariri witnessed the aftermath of the alleged attack. ( ABC News )

He said the man screamed, "he's trying to kill him".

One of Mr Hariri's friends who was trained in first aid then helped the injured man, who he described as "hysterical".

"We thought he was having a panic attack," he said.

"My friend applied pressure on him until the cops came."

The injured man was in shock but mentioned a missing girl and toilet.

Mr Hariri said he also claimed a scalpel was used against him.

"He was stabbed in the stomach and he had a slash in the back of his neck going all the way to his ear," he said.

"My friend said it was down to the muscle on the back of his neck."

Girl, alleged attacker not known to each other

Superintendent Julian Griffiths said the accused man had no links to the dance studio.

"It appears to be a random, isolated incident," he said.

"[He] will not be in a position to assist police inquiries until early next week or when we receive medical advice to confirm he's available to be spoken to."

Superintendent Griffiths also praised the actions of the man who intervened.

"He was aware that the child could not be accounted for and was assisting others in locating her," he said.

A police officer guards the scene of the alleged assault in Kogarah. ( ABC News )

The girl has been taken to Sydney Children's Hospital for observation.

"Her safety and welfare are paramount in this investigation," Superintendent Griffiths said.

Mr Hariri said frightened young dance students could be seen through the window of the dance studio after the incident.

"They were shaking ... really scared," he said.

The girl and the alleged attacker were not known to one another.

Superintendent Griffiths said a strikeforce had been set up to investigate the "concerning" matter.

"I think an incident like this will have everyone considering their own personal safety measures," he said.

"We would be encouraging people to continue to show vigilance in public areas or shared facilities."