SYDNEY—Dozens of people helped rescue a fellow commuter in Australia by pushing against train carriages to free the man whose leg had slipped between the platform and the train.

Closed-circuit footage released by the Western Australia State Public Transport Authority showed the man lost his footing while boarding the train at a station in the city of Perth on Wednesday. (There is no audio to the visuals)

A passenger alerted railway staff who stopped the train from leaving, local media said. When railway workers realized the man was stuck, they called on other passengers to help.

The footage showed dozens of people rushing to help tilt the carriages to free the man’s leg.

“It’s really heartwarming I think, to find an incident like this where everyone pitched in,” transport authority spokesman David Hynes said.

The man wasn’t named, but local media reported that he was believed to have escaped injury and caught the next train.