Egypt is generally considered a very safe place, and Cairo is perhaps the safest megapolis in the world — consider that in Rio you might be killed for your Nikes and in Mexico City gunned down in a gang war. That's why when something happens, it feels all the more surprising, especially for foreigners who think (usually rightly) that they have extra protection from the seedier side of the city. Check out the experience of this American blogger in Egypt first getting beaten up by some kind of protection racket, and then being arrested by police and forced to apologize to his attacker.
Muggings take place everywhere. But the way the police acts, as Egyptians know all too well, is a much more depressing and serious problem. When you think of some of the things that can happen in detention, the khawaga factor may have saved him from a worse fate than humiliation.
Conclusion: Egypt is a very safe place — until you have a problem.
Update: Also take a look at Sarah Carr's latest post for another take on everyday violence.