A man accused of repeatedly pricking a baby boy with a safety pin and hitting him in the head with a phone while on a train north of Sydney was on parole for several assaults, a court has heard.

Police said the 22-year-old man Brendon Duncan "cannot restrain himself" when requesting bail be denied for the alleged abuse that went on for over an hour against the 10-month-old baby.

The man was charged with domestic violence-related assault occasioning actual bodily harm and one count of common assault after was arrested at Woy Woy Railway Station Wednesday night after a passenger alerted police.

View photos

Brendon Duncan, 22, is accused of beating a 10-month-old baby on a Sydney train. Source: Supplied

Keeping her identity hidden, the witness told 7 News what she saw was "evil, just pure evil".

"When the baby wouldn't take the bottle the male then tried to punch the child," she said.

Onlookers were petrified with fear, and too afraid to intervene they called the police.

Mr Duncan fronted Woy Woy Local Court where it emerged he was released on parole in March having served 10 months for six assault charges, News Corp reports.

Police boarded the train at Woy Woy Station about 8.30pm on Wednesday after a passenger raised concerns about the alleged treatment of the child on the north-bound train.

The infant was in a pram next to his mother and the Mr Duncan. The child was taken to Gosford Hospital with head injuries but remains in a stable condition.

In a statement of facts presented to the court, police said the accused had allegedly tried to prick the child around the ears with a safety and hit him on the head with a mobile phone.

View photos

The baby's mother was taken away by paramedics. Source: 7 News

"Between Central and Woy Woy the accused was seen to utilise a safety pin to repeatedly prick the child around the ear and neck region, in an attempt to pierce the ear of the child," the police fact sheet stated.

"Throughout the journey the accused was also seen to hit the child in the head multiple times with his mobile phone. During the trip the child was dropped on the ground of the train, landing on his head. As a result the child had a minor laceration to his right eyebrow.

"The child appeared distressed and was crying hysterically and the accused and (the boy’s mother) told the child to 'shut up'."

Story continues