You are probably safer in Marrakech than in most European cities.

Several years ago the Moroccan authorities set up a Tourist Brigade Police Force, whose main objective is the safety and well being of foreign tourists. 

Naturally like any touristic city, there is opportunistic theft - It is not advised to leave Mobile phones, Cameras or any item that you value directly on the table at a Cafe whilst you enjoy your drink. Even packets of cigarettes have been known to be taken by opportunists.

There are also a number of pickpockets, and don't be fooled by people's appearances, even old ladies have been known to partake in a little pickpocketing.

But in terms of safety, you should have no fears. Even walking around late at night you are usually perfectly safe, though late at night you may get the odd bit of hassle from touts asking you if you want "something for the mind".  But take sensible precautions as you would anywhere; don't carry large sums of cash or wear expensive jewellery/watches, keep your bag strapped across your body, that sort of thing. 

The main thing to be concerned about is crossing the roads, as there are mopeds, bikes, cars and mules all competing. With regard to mopeds, they are illegal to drive in the medina but are somehow tolerated. They are driven slalom-like at speed along narrow paths with millimetres to spare. One slight "rule" is to walk on the right hand side of the street and let them avoid you rather than you trying to get out of their way. If crossing a busy road latch onto a Moroccan (preferably an old woman or one with a child) and follow their lead. Keep an ear open for the little beep of the moped approaching behind you and keep to the right side to let it pass. Bicycles are a bit of a pest too but the same rules apply.

It is also a common courtesy to the men and boys who push their carts through the winding alleyways, to let them pass. Listen out for their call ("Antak", "attention" or a hiss) as they approach you from behind and let them pass.

Visitors should also be aware of self-appointed tour guides who offer to help tourists navigate the maze of narrow streets, and then request payment for this. Acting as a guide without a license in Morocco is illegal. However, many do want to try to just make a few Dirham for the days meal.

Most will be polite and courteous, but some have been known to be intimidating and even fewer involving small gangs of men, who guide you to various places. 

Generally, if you do need help to find somewhere, ( such as a hotel ) you can usually find a lad or a boy who will lead the way. It is generally accepted to pay them 20 Dirham for their help, even though they may look unhappy with this, it is worth a lot to them. They may ask for more, but you just have to politely refuse. Another tip if you're lost is to ask some-one in a shop (they can't offer to guide you) to point you in the right direction.

If you do accept help for finding a hotel etc, the plain guide is to follow what your instinct tells you with regards trust.