Why are men holding hands?
Two men walking through the souk arm-in-arm, hand-in-hand, or with arms across each other's shoulders is one of the most ordinary sights in Morocco. It signals close friendship, family, neighbourhood — the same register as a Western man's pat on the back, scaled up. Boys do it from age seven, men do it into their seventies. There is no romantic reading at all.
By contrast, public affection between a man and a woman is restrained. Holding hands while walking is fine. Anything more demonstrative reads as inappropriate and, under Article 483, is technically punishable. The cultural map is the inverse of what visitors expect: same-sex platonic contact is warm and visible, mixed-sex affection is private.
If a Moroccan man takes your hand to walk you to a shop or down a derb, he is treating you as a friend. Pulling away reads as rude. (That said, see the entry on unsolicited guides — if he approached you on the street, the warmth has another goal.)