ALMATY - Suspected militants killed at least four policemen and one civilian in Kazakhstan's financial capital Almaty on Monday, security and hospital sources said, the second attack on the security services in less than two months.

The attackers targeted a district police station and an office of the KNB state security service. Another shootout occurred on a busy central street where police wounded and detained one of the attackers.

President Nursultan Nazarbayev called the attacks a terrorist act and ordered tighter security in public areas.

The shootings will stoke fears of a growing Islamist threat to the oil-producing nation of 18 million people. Last month, men the authorities said were Islamic State sympathisers attacked gun stores and a military facility, killing seven.

Nazarbayev said the security services were working to identify Monday's attackers, but one security source told Reuters the authorities believed they were militants.

Thousands of nationals from Central Asian nations are known to be fighting alongside Islamic State militants in Syria and Iraq, and the authorities have long warned they could return and carry out attacks on home soil.

Kazakhstan is far more prosperous than its post-Soviet neighbours and has been ruled with a firm hand by Nazarbayev since 1989. But the fall in global oil prices has hit its economy hard and there have been rare outbreaks of violence and public protests since April, initially caused by discontent over proposed land reforms but swiftly attracting others unhappy about wider issues.

Five witnesses told Reuters they heard gunshots in three parts of Almaty, the mainly Muslim nation's largest city. "We saw a man with a rifle," one shop worker said by phone. Footage uploaded to the Internet showed a man pointing an assault rifle at a car he tried and failed to stop.

The Interior Ministry said one attacker shot a policeman guarding a police station and then took his automatic rifle. He then shot two more policemen who chased him. The same man then tried to hijack a car, killing its civilian driver. He shot and wounded two more police officers before being wounded himself and detained on a busy street.

The ministry did not name the gunman but said the 27-year-old was also suspected of murdering a woman last weekend. It later said it had detained a second suspect.

It was unclear if any other suspects remained at large.

The ministry statement put the total death toll at four, including three policemen. However, a source at Almaty's emergency aid hospital told Reuters it had taken in six dead, including four policemen, one civilian and one suspected attacker.

There were also eight wounded at the hospital, the source said.

Last month, the KNB, successor to the Soviet-era KGB, said it had detained several members of a group planning "terrorist acts using improvised explosive devices" in the Karaganda region of central Kazakhstan. One suspect blew himself up.