A KiwiRail driver was attacked on his train in the Manawatu town of Feilding early this morning.
The rail operator's chief executive Todd Moyle said the lone driver was attacked by two people who had boarded the train illegally shortly before 3am.
The train was on a journey between Auckland and Christchurch. The driver stopped the train in Feilding to check something at the rear of the train around 3am.
He found two people had boarded the train illegally and when he asked them to leave they began to attack him.
"One of the offenders punched our [locomotive engineer] at that point. He had to then run to the front locomotive and locked himself in there but they proceeded to throw rocks at him and smash the windows in the train.
"So an incredibly serious incident."
Mr Moyle said the driver's cab was fitted with an emergency button which he was able to push to get train control to contact police.
"The dog team managed to apprehend one of the offenders and they're still in the process of finding the second one," he said.
The driver would be taking some time off duty to recover.
"He's in good spirits considering what he's had to deal with this morning but very shaken by the events. Nobody expects to turn up to work and have to face anything like our train driver did this morning."
He said attacks on drivers were incredibly rare.
"We've run trains with one person on the cab for a long time. This is an unusual event... it's very unusual.
"We will look at what's happened here and see if there are any learnings to come from it but the main thing we want to ensure though is that we don't have people boarding trains and don't have these sort of situations occurring."