President Uhuru Kenyatta on Tuesday afternoon annouced that Inspector-General of Police David Kimaiyo had resigned.
Addressing the nation from State House following the latest attack in Mandera early Tuesday, the President also announced the nomination of Kajiado Central MP Major-General (Rtd) Joseph Nkaissery as the Interior Cabinet secretary.
The fate of Joseph ole Lenku, who had been heading the docket since the Jubilee administration took over power, remains unknown.
The President said he acknowledged that there were some weaknesses in the security domain.
Addressing journalists earlier, Mr Kimaiyo said his resignation was a personal decision.
President Kenyatta also announced that he had written to the National Assembly to request that they extend their sitting to address the security issue.
"I too hurt and grief with you. In due course, our security situation will turn around," the President said.
He reminded county governments of their responsibility to work with the national government.
Saying Islam was a religion of peace, the President said that terrorists who claim to kill in the name of Allah were just "deranged animals".
He said that media must become an honest broker of national discourse.
"We come to the aid of terrorists when we shout at each other," said the President.
He extended his condolences to relatives of Kenyans who have lost lives in the recent attacks.
Earlier Tuesday, MPs had piled pressure on President Kenyatta to sack Mr Lenku and Mr Kimaiyo after the fresh terrorist attacks in Mandera and Wajir counties that led to the deaths of at least 39 people.
The legislators condemned the attacks, calling them heinous and an attempt to divide Kenyans along religious lines, adding that those tasked with protecting Kenyans had failed to do so.
Majority Leader Aden Duale led MPs in condemning the attacks at a press conference at Parliament where several legislators called for the resignation of the two government officials.
Mr Duale said the incessant attacks by Al-Shabaab militants were not different from other terrorist attacks across the world.
“There is no difference with what is happening in Syria, Nigeria and Iraq. These are acts of terrorists who are doing it in the name of Islam.
“It is not about Jubilee or Cord, it is a war against our nation. This is a war on all Kenyans regardless of their religion,” said Mr Duale who said he spoke on behalf of the Muslim MPs.
He asked Kenyans to remain united in the face of the attacks that have intensified over the last one week.
“Al-Shabaab wants to divide us along religious lines by attacking Christians. We are calling a crisis meeting as leaders from north-eastern (Kenya) to find a way to help the government deal with the situation,” added Mr Duale.
Kigumo MP Jamleck Kamau said the whole institution of the police force had failed the country and should be reviewed.
“It is the institution of police that is failing us. We have security officers in Mandera. From police commanders, NIS officers, a county commissioner and yet we have such attacks? All the officers need to be checked,” added Mr Kamau.
He went on: “It is becoming untenable that terrorists are attacking this country at will. It is possible that someone within the police could be sabotaging Kenya’s security. I fail to understand how a country with well-equipped police officers fails to prevent such heinous attacks.”
Kieni MP Kanini Kega said Mr Lenku and Mr Kimaiyo were not performing their jobs as required and should be relieved of their jobs.
“These are our children who had gone to look for employment. It is not as if we do not have police, intelligence service or a functioning Kenya Defence Forces. We are saying someone is failing somewhere. This is enough,” said Nyeri Town MP Esther Murugi.
After last week’s attack on a bus in Mandera, the legislators urged the President to sack the duo, but he did not heed the demand.
“It is sad that each week people are killed by terrorists. We are in a state of war. We are all uncertain about our insecurity.
"It is sad people charged with (ensuring) our security are sitting pretty, earning allowances and yet people are being killed endlessly,” said Nandi Hills MP Alfred Keter.
Nairobi Woman Representative Rachel Shebesh said it was painful to see Kenyans being butchered day in day out yet those in charge of national security were still in office.
“It is becoming too painful to always see Kenyans being butchered every now and then. The President must come out this time (a)round and take stern action against those not doing their roles as required,” said Ms Shebesh.
The MPs said it was vital for Kenyans to stand united in fighting the terrorist group.
“We condemn this heinous attack. We will not allow ourselves to be divided by people who are committing crimes in the name of Islam,” said Kisumu Town East MP Shakeel Shabir