Somalia's al-Shabaab insurgents have said they were behind a bus attack in northeast Kenya that killed 28 people yesterday, claiming it was in retaliation for raids on mosques in the port city of Mombasa.

"The Mujahideen successfully carried out an operation near Mandera early this morning, which resulted in the perishing of 28 crusaders, as a revenge for the crimes committed by the Kenyan crusaders against our Muslim brethren in Mombasa," Sheikh Ali Mohamud Rage, al-Shabaab's spokesman, said in an emailed statement.

The bus, which was travelling to the capital Nairobi with about 60 passengers on board, was hijacked at dawn yesterday about 31 miles from the town of Mandera, near Kenya's border with Somalia.

Some of the dead were public ­servants heading to Nairobi for the Christmas holiday. About 10 gunmen ordered all of the ­passengers out of the bus and separated those who appeared to be non-Muslims from the rest and shot them at close range, police said.

One of the passengers on the bus, Ahmed Mahat, told reporters the driver tried to accelerate away, but the vehicle became stuck in mud caused by recent heavy rains. About 10 heavily armed men talking Somali then ordered the passengers off the bus.

"When we got down, passengers were separated according to Somali and non-Somalis," Mahat said.

"The non-Somalis were ordered to read some verses of the holy Koran, and those who failed to read were ordered to lie down. One by one they were shot in the head at point-blank range."

Kenya's Red Cross said ­emergency workers were trying to retrieve bodies from the scene.

A shortage of personnel and lack of equipment led to a slow response by police when reports of the attack were received, police officers insisted. They said the attackers had more sophisticated weaponry than the police, who waited for ­military reinforcements.

Following the attack, a local official quoted by Kenyan media said the government had failed to answer pleas for extra security.

"This place has been prone to attacks," county official Abdullahi Abdirahman told The Daily Nation.

"This is not the first time the government has totally ignored us, and you can now see the how many innocent, precious lives have been lost."

The attack comes after a week of heightened tension in Mombasa, which has suffered a series of al-Shabaab attacks. Security forces raided mosques in the city, saying they were being used to store weapons. The raids triggered apparent revenge attacks by Muslim youths.

Kenya has been hit by a series of gun and bomb attacks blamed on al-Shabaab, which are linked to al-Qaeda, since it sent troops into Somalia in October 2011. Kenyan troops are part of the African Union Mission in Somalia, which is ­bolstering Somalia's weak, UN-backed government against the insurgency. Al-Shabaab has ­continued to carry out attacks in Somalia's capital despite being pushed out of Mogadishu in August 2011.

Authorities say that since Kenyan troops were deployed in Somalia, there have been at least 135 attacks by al-Shabaab inside Kenya, including the assault on Nairobi's upmarket Westgate Mall in September 2013 in which 67 people were killed.