Morocco is a safe country, safer than all European Mediterranean countries. Crime rates are low, and violence uncommon. There is also little to worry about from nature's side. Low temperatures in the winter, strong sun in the summer, undercurrents at certain Atlantic beaches are keywords for what to be careful about.
But unfortunate things can come your way here as well. Carrying small amounts of money, holding your camera close to your body, and be careful when you're in crowds. You should also shun all Moroccans fitting this description: Young man, in ordinary clothes, speaking several languages, and coming up to you warning you about the dangers of this and that. If they say they're students, they're most likely lying. But if they say they're guides, and offer to show you around the old city or something, at a certain price, there is less reason to be suspicious. But even in this case you should prepare to spend some time inside shops selling carpets or leather ware. If you run into somebody showing any kind of aggression in the beginning, call for the police. Not because your life is in danger, but because the police is the only ones who can get these people off your neck.
But the best advice is: With a smile and easygoing friendliness, even the worst hustlers won't do you any harm. When somebody run into real problems in Morocco, it's very likely that they pay a just and fair price for the racism that they or somebody around them carry in their hearts or in their acts. Moroccans are first class judges of character. But, not even the friendliest person should not stop looking well after his possessions.