Three people have been killed in Kenya's Lamu county after suspected al-Shabab fighters opened fire on a passenger bus, according to an official.

Larry Kieng, local police chief, said on Wednesday the bus was travelling from Mombasa to Kipini and was attacked in the afternoon.

He said the assailants shot from the bushes and fled once police escorting the bus engaged them.

Al-Shabab, the armed group based in neighbouring Somalia, has carried out more than 100 attacks inside Kenya, calling it retribution for Kenya deploying troops to Somalia in 2011.

In recent weeks, it has stepped up the attacks in Kenya's border counties of Lamu and Mandera.

READ MORE: The murder that shook the Kenyan elections

Al-Shabab has threatened to disrupt Kenya's August 8 elections in which President Uhuru Kenyatta is pitted against Raila Odinga.

The situation is already tense in the country in the run-up to the vote, with a senior electoral commission official recently found dead in a forest.

Dr Johansen Oduor, government pathologist, said on Wednesday that strangulation was the cause of the death of Christopher Msando, who was in charge of running biometric readers and electronic-transmission equipment meant to greatly reduce incidences of electoral fraud.

Msando, whose body was found on Saturday, had been hit by a blunt object and had deep cuts on his right arm, indicating torture.