Nairobi, Kenya - High-profile attacks in Kenya by the armed group al-Shabab at the Westgate shopping mall in Nairobi in 2013 and a university in Garissa in 2015 killed more than 200 people. The events changed the way the government deploys ground forces and carries out counterterrorism activities.

The Kenyan army took over control of the porous border with Somalia from police. Since then, Kenyan soldiers have spearheaded a large-scale ongoing operation in the Boni National Reserve, pushing al-Shabab fighters back into Somalia, greatly reducing the group's capacity to recruit and operate inside Kenya.

For years, the forest in the national park was easy cover for fighters moving between the countries. Analysts say Kenya's success in taking the fight to al-Shabab has made it a blueprint for dealing with violent groups in the region.

"When you look at the wider international picture, you'll find that starting from the 9/11 attacks in the US, Kenya thought they were clear of this international terrorism, until the threat came to Somalia and even closer, into the border," said Ahamed Mohammed, a retired brigadier-general with the Kenyan army.

"Being one of the major victims … we had to join the global war on terror," he said.

Technological advances

One of the reasons the Kenyan military has been so successful is close cooperation with international allies such as the United States and United Kingdom. Mohammed said advanced surveillance technology has given Kenyan ground forces the ability to monitor the movements and communications of armed groups, even identifying lone-wolf attackers.

"In the last few years there has been very good cooperation," Mohammed said. "International powers bring in the element of technology, which actually even picks out individuals whom you're after … our key benefit has been in the area of intelligence and getting first-hand information."

Once safe havens for al-Shabab, Kenyan security forces have taken back territory across Garissa and Lamu counties.

"We're happy people have been able to move back to their normal ways of life - going to the market, going to their farms and doing [business]," said Joseph Kanyiri, the commissioner of Lamu county.

"We've seen an increase in the number of visitors that we receive in Lamu, where we have pristine tourist destinations. We are equally happy that people who had moved from their farms to temporary internally displaced people camps have gone back to their farms and life is back to normal."

On Monday, a court ruled three men must stand trial on charges they were involved in a deadly attack on a Nairobi shopping mall in 2013. Prosecutors' evidence was accepted by a magistrate linking the three suspects to the days-long siege of Westgate Mall, in which 67 people were killed.

A fourth suspect was freed because of a lack of evidence. Al-Shabab claimed responsibility for the brazen attack.

Kenyan leaders have little doubt that security has improved in recent years. But many Kenyans still living in camps near the front line say pushing al-Shabab back into Somalia has given way to unforeseen threats closer to home.

'Multi-pronged strategy'

As people fled the conflict zone, armed Kenyan herders took over abandoned farmland to graze their animals and are now threatening anyone who tries to return. While the police and army remain focused on mitigating the external al-Shabab threat, those displaced by fighting are still too afraid to go home.

"When I went back to my farm and the rest of the people came back we were attacked by the herdsmen, [they] beat us," said John Mtemi Mwendwa, a displaced farmer living in the Katsaka Kairo IDP camp.

"They beat me till they smashed my finger and I could not function. I reported the matter to the police and they didn't bother at all. I wrote a statement and pursued the case. I eventually gave up.

"We have not received any help from the government. We are broke… If the government should talk to them and agree on something then we will be able to have peace."

For civilians living in conflict zones, the price of securing Kenya's borders has been high. Many say they lost loved ones in the fighting. Survivors say they are struggling to make a future.

Starting over

Katani Nyati is from Maleli village but is still living in an IDP camp. He said people normally save for two years to send their children to school and his plans were derailed by the fighting.

150404063748226

"My children have completed primary school and they have excelled. But now they can't go to high school or even start school from here," Nyati said.

"It's already difficult for me to provide for my family. There is no food [because] it was eaten by the animals. We are now starting life all over again … These are the challenges we are facing and we are stressed."

In the past, al-Shabab preyed on desperate communities to recruit fighters for their cause. Experts warn government complacency could start the cycle of violence over again.

Kenya's current strategy is multi-pronged.

Ground forces carry out military operations while local leaders conduct community outreach and engagement programmes to undercut al-Shabab propaganda in their communities.

Alongside soldiers, Kenyan President Uhuru Kenyatta even thanked civilians in his new year address to the nation for their role in disrupting armed groups.

"Our security services have continued working hard and intelligently," Kenyatta said.

"A big part of their success is coming from citizens stepping up to share information they have, while others take steps to completely delegitimise and de-glorify terrorism among its vulnerable targets for recruitment. As your president, I thank every man and woman who has played a role in our national campaign against violent extremism."