You were lucky, perhaps. I learned the hard way that sometimes walking away isn’t enough - you should run!
In the UK several years ago, I was walking with some friends to a party. It was dark and we were walking by a park. I was walking up ahead with one friend, but I heard some other voices and looked back to see that about ten people had come out of the park and were bothering another friend. I went back to hear him saying ‘Why are you bothering me? I haven’t done anything to you?’ I told him that we should just walk away. I waited till he walked on then walked on myself. One of the guys came up quickly behind me, got me in a headlock and got me on the ground. They kicked me a bit. In the meantime, my friends were looking back, horrified, from a safe distance - we were young students and had never seen anything like this before, so I can’t really blame them.
I don’t remember the next bit but a guy who was at a local probation hostel, and who was an ex-boxer, came up and told the group to f*** o**. By that time there were presumably a few more people around as well. The group ran away into the park. Dazed and shocked, I managed to get up and stumbled across the road, almost into the path of a car but the guy on probation pulled me out of the way.
The police came and quickly took details. One officer rather snidely said to the guy on probation ‘Don’t worry; we’ve already got your details’. I was taken to hospital for a checkup and pronounced OK.
I will always be grateful to that guy; the group of lads were a bit half-hearted and wouldn’t have killed me but they could have inflicted a bit more injury if not stopped. That took real guts; the guy was on probation (had just got out of prison in fact) and really didn’t need to get involved in any more trouble, but stuck his neck out to help a stranger.