Five Kenyan soldiers were killed in an attack claimed by the Somali group al-Shabab in Lamu County on Kenya's north coast on Wednesday, a senior official said.

The local government official in the county, who asked not to be named, said the attack occurred between the areas of Majengo and Bodhei. He said five soldiers were killed after their truck ran over an improvised explosive device.

"We heard a blast. Shortly after, KDF (Kenya Defense Forces) choppers were patrolling in the air," the official told Reuters.

Kenya Defense Forces spokesman Lt. Col. Paul Njuguna told Reuters that six soldiers were injured, two critically, in the explosion but none were killed.

It was not immediately clear why the accounts of the KDF and the county official differed.

Abdiasis Abu Musab, al-Shabab's spokesman for military operations, said the group was behind the attack on the KDF convoy, and put the number of those killed at nine.

Kenyan officials say the group often exaggerates casualty figures.

The al-Qaida-linked al-Shabab aims to topple Somalia's U.N.-backed government and impose its own strict interpretation of Islam. They have intensified attacks in Kenya since it sent troops into Somalia in 2011.

The group has launched several attacks, including ones in which they have beheaded people, in the past year in the coastal county. Kenyan security officials say the militants have used the Boni forest straddling the Kenya-Somalia border as a hideout and base for attacks.