MOSCOW (AP) — Five suspected militants were killed in gunbattles with police that followed a series of recent armed attacks that have challenged the stability of the energy-rich ex-Soviet nation of Kazakhstan, authorities said Friday.

Kazakhstan’s National Security Committee said in a statement that its agents tracked down four suspects hiding in an apartment building early Friday in Aktobe, a city in the northwest, about 70 kilometers (some 45 miles) south of the Russian border.

The agency said the suspects refused to surrender, fired on police and security officers, and were killed in the ensuing gunbattle.

Another gunman fired at police at a different location and was killed by retaliatory fire. Two police officers were wounded, the committee said.

At least 20 people were killed in Aktobe on Sunday when groups of gunmen attacked a military base and gun shops. The death toll comprised three servicemen, four civilians and 13 attackers. Nearly 40 people were wounded.

Kazakhstan’s authorities described the violence as a terror attack and blamed it on radical Islamists. Police and security forces have launched a sweeping hunt for those involved.

The National Security Committee said Friday that it was continuing the search for some attackers who have remained at large.

The violence has shaken Kazakhstan and set a serious challenge to 75-year old President Nursultan Nazarbayev, who has led the energy-rich Central Asian nation since before the 1991 Soviet collapse. He has maintained a tight grip over the nation’s political system, winning his fifth presidential term in 2015 with 98 percent of the vote.

Kazakhstan’s economic fortunes have collapsed due to slumping prices for oil, its main currency earner, and the economy is expected to slow to 0.5 percent growth this year. On top of economic problems, a new law allowing foreigners to own agricultural lands has fueled discontent and triggered protests across the country.

Some observers saw the attacks as a sign of an intensifying battle for influence among political clans in Kazakhstan, while others have pointed at possible foreign influence.

In an address to the nation earlier this week, Nazarbayev said “adherents of radical pseudo-religious movements who got their instructions from abroad” were behind the attacks. On Friday, he told his Security Council that the perpetrators of the attacks were followers of fundamentalist Salafi Islam.

Nazarbayev ordered authorities to toughen criminal punishment for Kazakh citizens who join international terrorist organizations, strengthen protection of guns shops and military arsenals and tighten control over migration flows. Following Russia’s example, the Kazakh leader also called for closer monitoring of foreign funding of Kazakh organizations.

Officials in Russia and some other ex-Soviet nations have viewed the ultraconservative Salafi movement as a security threat, saying many of its followers have joined the Islamic State group in Iraq and Syria. They warned that they may pose a major security threat if they return home.