Rio de Janeiro: How safe is it really?

The guidebooks say the favelas are safe, scaremongering bloggers suggest not to go out after dark. Thankfully we ignored the warnings not to go out at night, but there is a sinister side, and people who live in Rio say it's getting worse...