Wedged in the middle of chaos, bordered by the long-running instability of South Sudan to the northwest and Somalia to the east, the East African nation of Kenya is striving to maintain the feeble balance of welcoming refugees while securing their borders from the infiltration of terrorists.

“Kenya is a country that lives in a very fragile neighborhood, and that is a fact. But with a million refugees from different parts of our region, we have always said this would be and will be a safety for all,” Kenyan President Uhuru Kenyatta told Fox News in an exclusive interview. “Now, that comes with its own challenges because of the instability in Somalia, which we try to assist and try to work together with our Somali brothers and sisters, the Somalia government. But at the end of the day, they are not in complete control of their region -- so what happens? You get terrorist groups developing, you get terrorist groups finding safety; unfortunately, we have become a target.”

In particular, the Somalia-based militant group al-Shabab has for the past decade continued to fight the Western-backed Mogadishu government with the ultimate goal of imposing hard-line Islamic law, and it continues to wreak havoc across Kenyan territory.

NEW AL QAEDA CELL FORMS IN BURKINA FASO, AS TERROR GROUP CEMENTS FOOTHOLD IN AFRICA

Two weeks ago, eight Kenyan police were killed by a roadside bomb in the border region – the attack claimed by the Somali Islamist terrorists. In January, some 21 people were slain and another 28 wounded in a 19-hour siege on the affluent DusitD2 hotel.

This frame taken from video shows a scene of an explosion in Kenya's capital, Nairobi, on Jan. 15. Gunfire and explosions were reported near an upscale hotel complex. (AP Photo/Josphat Kasire)

This frame taken from video shows a scene of an explosion in Kenya's capital, Nairobi, on Jan. 15. Gunfire and explosions were reported near an upscale hotel complex. (AP Photo/Josphat Kasire)

In December 2015, gunmen shot dead some 28 mostly Christian teachers on a bus heading home to Mandera from Nairobi for the Christmas holiday. A year earlier in Mandera, al-Shabab extremists slaughtered 36 quarry workers’ execution-style.

In April of 2015, an al-Shabab terror cell opened fire on Kenya’s Garissa University, killing 148 students -- most of them Christian. In September 2013, more than 70 lives were lost in an al-Shabab massacre on Nairobi’s upscale Westgate Mall.

“We are making steady, good progress. But I would be lying to you if I said that we had dealt with the problem,” Kenyatta acknowledged. “But neither has any country. We do have a constant threat of terrorist attacks, but we are not alone.

"The whole world is on its toes.”

President Kenyatta in an exclusive Fox News interview

President Kenyatta in an exclusive Fox News interview (Fox News/Hollie McKay)

A prominent sticking point is the growing tension between Nairobi and Mogadishu over maritime borders and occupation. Since 2011, Kenyan military forces have presided over a pocket of southern Somalia, usurping control of territory from al-Shabab in frustration over a then-growing number of abductions on Kenyan turf.  Yet the militants have consistently claimed that they stage attacks across Kenya in retaliation against the troop presence in Somalia.

There is no sign that Kenyans will withdraw until Somalia forces get a tighter grip over terrorist elements.

The Kenyan troops "are not in Somalia for any other reason but to work with the Somali administration, to work with international partners to ensure we give them the necessary support to secure their own country,” Kenyatta insisted. “And if they secure their country, by extension, they secure ours.”

Security concerns are also embedded in the long-running refugee presence.

More than three years ago, the Kenyan government controversially announced that the UNHCR-run Dadaab refugee complex, just 60 miles from the Somali border, would be closed. Officials cited intelligence suggesting that the sprawling 300,000-person camp, which was opened almost three decades ago at the onset of Somalia’s civil war, had become a dangerous training ground for al-Shabab terrorists planning attacks and stashing weapons.

“The big problem is, if you look at our north, it is a very fragile environment, and we started to have very serious problems, especially with the huge influx of refugees. And this increased the pressure on the resources we were able to provide,” Kenyatta said. “It got to a stage where we as Kenyans felt that maybe we were carrying more burden without the international community also coming in. We said, 'Look, it is becoming more of a problem than we can manage, a problem to our own people.'”

SHUNNED CONGOLESE REFUGEE ON RAISING A SON BORN OUT OF RAPE: THE BABY HAD A RIGHT TO LIVE

Yet ongoing proclamations to formally shutter Dadaab – amid an outcry from human rights and aid groups – were blocked in 2017 after a High Court judge ruled the move unconstitutional, saying the forced closure violated international obligations.

Kenyatta said the government has since engaged more with the U.N. and international partners, and that for now, the focus is on trying to guarantee that adequate mechanisms are in place to keep the encampment stable as volunteer repatriations are dangled. The future of hundreds of thousands at the camp, under the skeptical eye of international aid groups, remains in limbo.

For the moment, the battle for border control -- like the balance between international law and a commitment to support refugees from the neighboring nation -- is a delicate dance, given that the 450-mile line between the two countries is largely porous.

“We do what we can using technology, using partnerships, using physical barriers. Not that we want to keep our neighbors out, but so that we can have a controlled way in which our citizens can move,” Kenyatta said. “It’s how to balance between receiving and accepting and giving refuge to those who seek safety, while at the same time ensuring that criminal and terrorist elements don’t take advantage of that to create mayhem in our country. But the first thing with border security is that there has got to be a partnership between stable governments.”

MINNESOTA LAWMAKER'S PUSH FOR TOUGHER FEMALE GENITAL MUTILATION LAW FACES OPPOSITION

Beyond the scope of fighting terrorism, the reigning president of six years has pledged to boost the role of women and girls. From his vantage point, it’s a pivotal piece of the country’s economic policy, given that 50 percent of the population has historically been cut out of business, education and vocational opportunities.

“We know that the playing field hasn’t always been level, so have to actively implement programs and formative action programs to ensure women can play their proper role to getting us to where we want to be as a nation,” Kenyatta said. "That way we will double our growth, double our prosperity. We must include all we are to achieve our true prosperity."

Somali al-Shabab fighters stand stand guard during a public flogging by the hardline Islamic group in Bula Marer town, December 13, 2008. Somalia's President Abulahi Yusuf sacked his prime minister on Sunday, saying he had failed to bring security to the chaotic country. A respected Somali rights group said this week that fighting in the Horn of Africa country had killed more than 16,200 civilians since the start of last year, when allied Somali-Ethiopian forces drove the Islamists out of power. Picture taken December 13, 2008. REUTERS/Ismail Taxta (SOMALIA)

Somali al-Shabab fighters stand guard during a public flogging by the Islamic group in Bula Marer town in 2008. (Reuters)

The swift arrest of a member of Kenya’s National Assembly last month – he was alleged to have brazenly slapped a female MP in Parliament after becoming enraged over her decision not to allocate money to his constituency – is a sign of quick official action, but also an indicator that there's still a long way to go.

GET THE FOX NEWS APP

Moreover, Kenyatta has vowed to end the abhorrent practice of female genital mutilation (FGM) by 2022, which will mark the end of his second and final term in office. Despite being outlawed eight years ago, the cultural cutting ritual, intended to maintain the “purity” of young girls but replete with dangerous and potentially fatal side effects, is still performed in shadow. At least 21 percent of Kenyan women have undergone FGM, according to a 2014 Kenya Demographic Health Survey.

It's not just the law that's key to stopping it, experts say. Also important is education and other programs.

“It is one of the promises I have made and that I hope I will be able to achieve. We will do everything we can to ensure that we eliminate FGM before the end of my term, and we have already made progress,” Kenyatta said. “We have criminalized that element, we have said that women should be in charge of their bodies, and that is part and parcel of empowering them.”