Most of the time we stayed in Casablanca - the largest city (officially over 3 million people, unofficially even more) and the business center of the country. My first welcome was being pickpocketed.
Rabat, the capital, is only an hours train ride from Casablanca. It is a smaller city, more peaceful and cleaner. We explored the medina, the old kasbah and government buildings.
While Rabat and Casablanca are coastal cities, Marrakesh in in the highland, close to the Atlas mountains. The new part of the city actually look more civilized than Casablanca, but the medina is very big and an interesting place to explore.