The attack by al-Shabab occurred in villages that border Somalia, an area where the group often carries out raids.