Somalia's Islamic extremist rebels, al-Shabaab, claimed responsibility for the Saturday dawn attack on a bus in which 28 non-Muslims were singled out and killed.

Al-Shabaab claimed responsibility for the attack through its radio station in Somalia saying it was in retaliation for raids by Kenyan security forces carried out earlier this week on four mosques at the Kenyan coast.

Nineteen men and nine women were killed in the bus attack, said Kenyan police chief David Kimaiyo.

Kenya's military said it responded to the killings with airstrikes later Saturday that destroyed the attackers' camp in Somalia and killed 45 rebels.

The bus travelling to the capital Nairobi with 60 passengers was hijacked about 50 kilometres from the town of Mandera near Kenya's border with Somalia, said two police officers who insisted on anonymity because they were ordered not to speak to the press.

The attackers first tried to wave the bus down but it didn't stop so the gunmen sprayed it with bullets, said the police. When that didn't work they shot a rocket propelled grenade at it, the officers said.

The gunmen took control of the vehicle and forced it off the road where they ordered all the passengers out of the vehicle and separated those who appeared to be non-Muslims — mostly non-Somalis — from the rest.

George Ochwodho, a non-Muslim head teacher of a private primary school in Mandera, survived the attack. He was travelling home for the Christmas vacation since school had closed.

Passengers quizzed on Islamic creed

Ochwodho told AP that the passengers who did not look Somali were separated from the others. The non-Somali passengers were then asked to recite the Shahada, an Islamic creed declaring oneness with God. Those who couldn't recite the creed were ordered to lie down. Ochwodho was among those who had to lie on the ground.

Two gunmen started shooting those on the ground; one gunman started from the left and other from the right, Ochwodho said. When they reached him they were confused on whether either had shot him, he said.

Ochwodho lay still until the gunmen left, he said. He then ran back to the road and got a lift from a pick-up truck back to Mandera where he was rushed to hospital. He spoke from a hospital bed where he was being treated for shock.

United States Somalia

Al-Shabaab is better equipped than Kenyan police, who waited for military help before responding to the hijacking. (Associated Press)

17 out of the 28 dead were teachers according to the police commander in Mandera county.

A shortage of personnel and lack of equipment led to a slow response by police when the information was received, said two police officers who insisted on anonymity because they were ordered not to speak to the press. They said the attackers have more sophisticated weaponry than the police who waited for military reinforcements before responding.

135 attacks since October 2011

Kenya has been hit by a series of gun and bomb attacks blamed on al-Shabaab, who are linked to al-Qaeda, since it sent troops into Somalia in October 2011. Authorities say there have been at least 135 attacks by al-Shabaab since then, including the assault on Nairobi's upscale Westgate Mall in September 2013 in which 67 people were killed. Al-Shabaab said it was responsible for other attacks on Kenya's coast earlier this year which killed at least 90 people.

Al-Shabaab is becoming "more entrenched and a graver threat to Kenya," warned the International Crisis Group in a September report to mark the first anniversary of the Westgate attack. The report said that the Islamic extremists are taking advantage of longstanding grievances of Kenya's Muslim community, such as official discrimination and marginalization.

Kenya has been struggling to contain growing extremism in the country. Earlier this week the authorities shut down four mosques at the Kenyan coast after police alleged they found explosives and a gun when they raided the places of worship.

Some Muslims believe the police planted the weapons to justify closing the mosques, Kheled Khalifa, a human rights official said Friday warning that methods being used to tackle extremism by government will increase support for radicals.

One person was killed during the raid on two of the mosques on Monday. Police said they shot dead a young man trying to hurl a grenade at them.

The government had previously said the four mosques were recruitment centres for al-Shabaab.