Seven people have been shot dead in an attack on a mosque in a village in north-eastern Kenya near the border with Somalia, officials have said.

Villagers told the BBC that 10 gunmen opened fire as people were leaving the mosque after early morning prayers.

Five men were killed and then two women who heard shots and came to investigate were also shot dead.

The attack comes less than two weeks before elections in a region where security is a problem.

Residents of Malaley 1 village said nothing was stolen and the gunmen then fled.

The village is about 45km (28 miles) from Dadaab refugee camp, which houses some 500,000 people who have fled years of conflict and drought in Somalia.

In the past year, the region has also been prone to attacks blamed on al-Qaeda-aligned Islamist militants in Somalia.

The Somali al-Shabab group vowed to take revenge when Kenya sent troops into Somalia in October 2011 to help the UN-backed government seize territory from the militants.