The Verdict: Clear Path
As the spouse of a Moroccan you can get the long-term resident card, which is simpler than the retirement card. Apply at the police foreigners' service with your marriage certificate as registered in Morocco.
Article 17 of Law 02-03 provides the resident card (carte de résidence) to the foreign spouse of a Moroccan, on condition that you entered and are staying lawfully.
Bring your passport, the marriage certificate, your spouse's national ID card and proof of your home. The marriage must be recognised under Moroccan law, which does not recognise same-sex marriage or a Muslim woman's marriage to a non-Muslim man; if either applies, this route is closed and the retirement card is the one to look at.
If you are a woman married to a Moroccan man, after five years of living together lawfully in Morocco you can also declare for Moroccan nationality; our Morocco marriage quiz covers it.