Similar story when I visited Nairobi with my then-partner: stayed in a fenced compound with guards; and when we visited my partner's friend, on the bus to her place we passed a supermarket which was guarded by someone holding a light machine gun.
We visited somebody in Nairobi. She picked us up at the airport. On the way into her apartment complex, she had to stop her car while the guards ran mirrors under the car to check for bombs.