OUAGADOUGOU, Burkina Faso — Gunmen killed at least 24 people, including a pastor, in an attack on a church during Sunday Mass in northwestern Burkina Faso, four security sources said on Monday.

It was not immediately clear who was responsible for the attack, but jihadist groups with links to Al Qaeda and the Islamic State are seeking to gain control over rural areas of Burkina Faso by exacerbating ethnic and religious conflict.

Hundreds of people have died over the past year, and more than half a million have fled their homes.

The timing of the shooting, during a church service in the village of Pansi in the Yagha region, mirrors other recent attacks on Christians, including assaults on churches and the assassinations of pastors and priests.