Hi
There are some rules you need to check
Ideally it would have made easier if yo had and engagement in Morocco when you were there.
The easiest of way would be for you to have Visit him again and marry in Morocco at least with a small reception,
There are soem conditions one need to meet to register a marraige in Morocco
1) the Parties should be of the same Faith (muslims)
2) if the foriegner is a non muslim it cannot be registered in Morocco
3) the Foreign party in this case you should have a document that states you are currently not married, (an Affidavit from a Lawyer/Solicitor) or stating that divorced and single
4) Birth certifate indicating age/@#$%&
5) A Record from the foreing country to validate the person does not have any leagal proceeding at the moment and clear from any criminal records
Once you marry while you are in Morocco you should ask hime to paply for visa whiles you are there.
This would be the easiest.