For perspective in strength and the effect on damage of building standards, the 1989 Loma Prieta earthquake was magnitude 6.9, and was responsible for 63 deaths. It shook houses off their foundations in SF's Marina District and brought down an upper section of the 1936 SF-Oakland Bay Bridge and a section of the 1957 Cypress St. Structure of Interstate 880, but this was minor in comparison to this quake in Morocco.
Buildings made of un-reinforced masonry are not very flexible, and with enough shaking, they collapse. This probably happened a lot in Morocco. Third world countries are also inconsistent about having good building standards and enforcement thereof. That may also be a factor in Morocco's death toll.
Marrakech is in the heart of Northern Africa's Atlas Mountains, so it's probably in a significant seismic zone.