When a train driver in Spain reached the end of his shift, he decided to clock out and go home. But there was just one problem – the train he had been driving was 300 kilometers from its destination, leaving over 100 people stranded for hours.

The Renfe train, which had been en route from the northern coastal city of Santander to Madrid, suddenly stopped outside the town of Osorno at 9:15pm on Tuesday night, two hours into its journey.

The passengers were initially told the train had stopped for technical reasons, but later learned the driver had finished his shift and was refusing to work overtime.

Annoyed passengers were told they had to wait until alternative transportation could be found. Several hours later, a replacement bus service arrived to transport passengers to Madrid, The Local reported.

The passengers finally arrived at their destination at 2:30am.

Renfe is currently in a labor dispute with its train drivers, who have taken strike action to protest a shortage of workers. However, a spokesman from the train driver union Semaf said the driver was not staging a protest. Instead, he was required to clock out to satisfy legal requirements.

“Drivers are not allowed at the controls for longer than five-and-a-half hours straight,” spokesman Carlos Segura said, as quoted by El Diario de Montanes newspaper.

“He repeatedly told headquarters that he was coming to the end of his shift and would go into overtime but received no answer, so he had to stop.”

Segura added that the train company "should have had a substitute driver lined up, but it didn't happen," adding that the union has "seen similar things in the past."

Meanwhile, Renfe has apologized for the incident and issued full refunds to all 109 passengers. The company has also launched an investigation into the incident.