Tajikistan blamed Islamic State for an attack on Wednesday on a military checkpoint that killed 17 people near its capital, Dushanbe.
Islamic State of Iraq and the Levant (Isil) has not commented, but in May the Tajik authorities accused the extremist group of inciting deadly violence in a prison.
Last year, Isil claimed responsibility for killing four Western tourists in Tajikistan.
According to Tajikistan’s National Security committee, 20 masked gunmen attacked the checkpoint, 60km (37 miles) west of Dushanbe, at 3.23am local time.
“The special convoy (all members of the so-called Islamic State terrorist group) invaded from the Islamic Republic of Afghanistan,” it said.
Fifteen militants were killed in the firefight and five were captured, including one woman. Two soldiers were also killed.
Official photographs showed the bodies of several men dressed in black lying on a bloodied dirt road next to discarded assault rifles and magazines.
At least one of the dead men also had his hands bound behind his back. Other pictures showed the burnt-out wreckage of at least three cars.
Security was tightened around Dushanbe after the attack and there were notably more armed police than usual patrolling the centre of the city.
Security analysts in Russia and Central Asia have previously warned that the Taliban and Isil would target Tajikistan from neighbouring Afghanistan.
President Emomali Rahom rules Tajikistan, considered one of the poorest and least stable states in former Soviet Central Asia, virtually as his personal fiefdom.
It lies on the drug route to Europe from Afghanistan, heading north from Tajikistan through Kyrgyzstan, Kazakhstan and Russia.