Uhuru Kenyatta, the Kenyan president, has dismissed his interior minister and accepted early retirement for the head of the police, just hours after Somalia's armed group al-Shabab said its fighters had killed at least 36 people at a stone quarry in the northeastern city of Mandera.

In a televised address, Kenyatta on Tuesday pledged to continue the fight against al-Shabab and announced a security shake-up in which the interior minister, Joseph Ole Lenko, was dismissed.

Kenyatta named an opposition politician and retired army general, Joseph Nkaissery, to be the new interior minister, in charge of security.

At a news conference in the capital Nairobi, David Kimaiyo, the police chief, announced he was stepping down and that the president had accepted his early retirement.

The two men have been responsible for the east African nation's security, which has deteriorated amid a wave of deadly attacks blamed on al-Shabab.

"My government has invested heavily in terms of increasing recruitment of security personnel; improving their welfare ... Despite this progress, we also acknowledge some weakness in our security architecture," he said.

Non-Muslims singled out

Kenyatta said he had asked top security officials to work with legislators and find out whether there were administrative and legal hurdles that limit the country's "ability to deal with this real and existential threat".

About 20 attackers, described by the Kenyan government as "heavily armed bandits", opened fire at the quarry in the early hours of Tuesday morning after separating Muslims and non-Muslims, sources said.

Several people were beheaded, while others were shot in the back of the head, sources told Al Jazeera. Al-Shabab claimed responsibility for the attack, calling it "another successful operation carried out by the Mujahideen".

The scene at the Mandera quarry [The Kenya Star]

"This latest attack was part of a series of attacks planned and executed by the Mujahideen to serve as a response to Kenya's occupation of Muslim lands and their ongoing atrocities therein, such as the recent air strikes on Muslims in Somalia," Sheikh Ali Mohamud Rage, al-Shabab spokesperson, said in a statement emailed to journalists.

The dead are reportedly miners who worked in the quarry, located just outside the town. Shortly before the attack they were woken by the gunmen and forced to leave the tents where they were sleeping.

Al Jazeera's Catherine Soi, reporting from Nairobi, said the government had been under a lot of pressure to fire the two security chiefs.

The attacks had become frequent and the two men have been blamed by Kenyans for failing to provide adequate security, she said.

She also said the Red Cross was at the scene of Tuesday's attack and that the military and army were heading to the site, which is just 5km from the border with Somalia.

"We are being told that many of the people who work in the quarry are not from Mandera," our correspondent said, adding that those killed were non-Muslims.

"This comes at a time when security in Mandera has been beefed up because of recent attacks. We just returned from Mandera and the security forces there assured us they are in control of the situation, but they said that the border there is also very porous."

Nightclub attack

The scene of the latest attack is about 30km from the November 22 raid on a bus in which 28 non-Muslims were separated from the Muslim travellers before being executed.

The shooting in the quarry comes after an attack on a nightclub in the Kenyan town of Wajir on Monday night.

One person was killed and at least 12 injured as armed men hurled grenades and sprayed bullets at the building, the government said.

The Kenyan government, in a statement, said investigations were under way to look into both incidents.

Kenya sent troops to neighbouring Somalia in 2011 to rein in al-Shabab after raids on its coastal cities blamed on the armed group.

It has since come under a wave of deadly attacks, including the September 2013 assault on the Westgate shopping mall, which killed at least 67 people.

Al-Shabab has called for the withdrawal of the troops which have since joined forces with African Union peacekeepers in the Somali capital Mogadishu.

Source: Al Jazeera and agencies