A gunman fired on a group of mourners leaving a memorial service for a local politician in South Africa, killing at least four people and injuring three others, police said Wednesday.