Analysts say the resignation of the head of Kenya's intelligence agency last week could open the way for much-needed improvements to the country's security agencies as they struggle to deal with a series of violent attacks.
Many argue that the roots of the ongoing security crisis go much deeper than alleged failings in the National Intelligence Service (NIS) and that radical systemic changes are needed.
Michael Gichangi, a former major general in the Kenya Defence Forces (KDF), was appointed head of the NIS in 2006 and began his second five-year term in the post in 2011. On August 13, however, the president's office announced that he was stepping down.
His replacement has since been named as Major-General Philip Kameru.
Officially, Gichangi is leaving the job for personal reasons. However, newspaper reports have claimed that a rift between him and the chief of the KDF, General Julius Karangi, was the real reason for his resignation.
The former intelligence chief had been accused of being aloof and of having an awkward working relationship with other top security officials.
Some commentators also argued that the NIS's recent failure to prevent attacks made Gichangi's position untenable.
Over the last year, Kenya has suffered a wave of attacks, most notably when fighters from the Somali Islamist group al-Shabab took over a busy Nairobi shopping centre last September, killing at least 67 people. Since then, there has been a succession of attacks in the coastal city of Mombasa and in Eastleigh, a Somali-dominated suburb of Nairobi.
Al-Shabab bombings and shootings are seen as retaliation for the ongoing Kenyan military operation against the militants in southern Somalia.
In June, attackers struck in the coastal region of Lamu, killing more than 50 people in the town of Mpeketoni. (See Kenyan Politicians Urged to Unite Following Attacks.) Al-Shabab claimed responsibility for these strikes but Kenyan president Uhuru Kenyatta blamed "local political networks".
The raids on the coast and in Nairobi have prompted a series of travel warnings from foreign embassies including those of Britain and the United States, which have badly hit tourism, a vital component of Kenya's economy.
The NIS has rejected criticism of its operations, claiming that it provided advance intelligence about attacks which other security agencies failed to act on. After the Mpeketoni incident in June, Kenyatta admitted that the NIS had alerted the authorities to an imminent attack but no action had been taken.
Some experts view Gichangi's resignation as a positive step, arguing that the NIS needs to do more than merely inform other agencies of potential attacks.
Bashir Haji Abdullaih, a security analyst who previously served as a major in the Kenyan army, told IWPR that lack of coordination between different arms of the security services was a key problem.
"The NIS has failed to follow up on intelligence they give to the police, to see it is acted upon," he said. "They cannot say, 'we have given the police information' and then sit back. Both the NIS director and the [inspector general of police] should work together to ensure intelligence given is acted upon."
Abdullaih warned that Gichangi's successor needed to ensure that the NIS, the police and the army all cooperate with each other. But other experts argue that the NIS has done its best and that the security problems run much deeper.
"There have been instances where intelligence reports have been ignored just because it was not politically expedient to act on them," Raymond Kipkorir Cheruiyot, a retired colonel who now runs the company Multi Security Consultants in Nairobi, told IWPR. "The 2007/08 election violence was reported by the NIS but it was ignored for some reason. The same happened in Lamu [in June 2014]. There was a deliberate failure to act because it was not politically correct to act."
Simiyu Werunga, director of the African Centre for Security and Strategic Studies, told IWPR that Gichangi's resignation was a big loss to the country. He argued that the NIS's mandate was to prepare an intelligence report and hand it over to the relevant security agencies to act upon.
Werunga said failures within other arms of Kenya's security system, particularly the police, must be addressed.
"Gichangi is not to blame for the bad security situation," Werungu said. "Securing the country is the responsibility of the police. Even then, [Gichangi] does not have the mechanisms to follow up on intelligence given to the police."
He said that security lapses which had cost the lives of hundreds of Kenyans were attributable to a lack of coordination between different parts of the police force.
This view is supported by Kenya's Independent Policing Oversight Authority (IPOA), whose chairman Macharia Njeru blamed the poor security situation on a lack of cooperation among police services and the NIS.
The police and its criminal investigation department (CID) fall under the command of the inspector general of police, David Kimaiyo. A separate, paramilitary branch of the force - the Administration Police - falls under a separate command.
"Security challenges facing the country today are attributable to a lack of a cohesive strategy by top police commanders, specifically, Kenya police, Administration Police and the CID," Njeru said. "Further, policing has to be intelligence led."
Last month, an IPOA report into a April 2014 security operation in Nairobi, in which thousands of civilians were rounded up and detained, gave details of widespread police misconduct. (See Kenyan Security Forces Accused of Stoking Tensions.)
"There were many allegations received by the IPOA inspections and monitoring teams of police officers receiving bribes to release persons before they got to police stations and of police officers without uniforms or identification documents arresting persons and demanding bribes," the report stated.
It also concluded that such incidents came about due to "a clear lack of close supervision of junior officers by their seniors in violation of the [National Police Service Act] and police operational guidelines".
Aside from these issues of discipline, security analyst Abdullaih told IWPR that the various policing agencies did not have clear command structures and failed to coordinate operations.
"The ideal is for all internal security organs including the National Intelligence Service, the regular police and Administration Police to form part of the police service and have a uniform way of doing things," Abdullaih said. "There should be inter-agency coordination and training."
Abdullaih called for a radical overhaul of the approach to security, accusing Kenyan leaders of failing to "give direction".
"The seriousness of the security situation in the country demands a change of strategy," he said. "Currently there is confusion."
Wanja Gathu is a freelance reporter in Nairobi. This article was produced as part of a media development programme implemented by IWPR and Wayamo Communication Foundation.