A STUDENT has been saved from a vicious assault - not by the boys in blue but the men in black.

Ninjas scared off three thugs who had the misfortune to attack the 27-year-old medical student outside their warrior school.

The German exchange student had been targeted by the men while he was riding the late-night train home, The Sydney Morning Herald reported.

They demanded he give them his wallet but when he refused and got off the train, they followed.

They pounced as he made his way through a dark alley in Sydney's west.

They grabbed his phone and iPod and kicked him while he lay on the ground.

However, the men were spotted by a member of a nearby dojo.

Nathan Smith told his sensei and the rest of the students at Ninja Senshi Ryu and they rushed out to confront the thugs - all dressed in traditional black ninja garb.

On seeing the ninjas, the men fled, only to be later arrested by police.

"You should have seen their faces when they saw us in ninja gear coming towards them," the school's sensei, Kaylan Soto, told the Herald.

They also failed to notice a ninja, Nathan Smith, standing in the shadows outside the dojo. Mr Smith immediately alerted his sensei, or teacher.

Another ninja, Steve Ashley, said: "It was probably the worst place in Sydney where they could have taken him."

Originally published as Ninjas rescue student from muggers