Yep...as I thought.
It's not cut and dried. I was in Marrakech earlier this year, and didn't think twice about local laws - and me and my partner were sharing a double bed.
It's not good enough to say, "Well it's their laws", because they are not laws that are strictly adhered to.
Indeed , from the following link:
http://www.frommers.com/destinations/morocco/642777#sthash.qJDase2v.dpbs
Homosexuality is considered relatively common, though rarely acknowledged, amongst Moroccan men. Even though illegal and punishable with imprisonment, the lack of everyday integration between the sexes has lent itself to a general and subtle tolerance toward male effeminate behavior. Platonic affection between Moroccan males -- such as holding hands, which is a sign of friendship and respect -- is freely shown, and some of the Berber tribes (the Atlas Chleuh, for example) are known as particularly tolerant toward homosexual behavior.
For both gays and lesbians, discretion is advised. Avoid public displays of affection, as this is something that is even frowned upon when shown by a heterosexual couple. Tangier -- the world's first gay resort -- is still considered somewhat gay-friendly.
Marrakech certainly has a mini gay scene, thanks largely to the number of gay French couples now residing there.