It is autumn in Dushanbe, the Tajik capital, and for a brief moment, the weather is stunningly beautiful—perfectly crisp and sunny, but not cold. Much of the city’s low-lying, subdued architecture—a particular Central Asian hybrid—is quite attractive; the broad avenues, lined with large pine and chestnut trees, remind you a bit of Paris. But the atmosphere in Tajikstan, which shares an 800-mile border with northern Afghanistan, is anything but calm.

In the valleys north of Dushanbe, militant groups that may have ties to extremists in Afghanistan and Pakistan have killed some fifty soldiers and downed at least one military helicopter in the past three months alone. The urgent question is whether the Taliban, al-Qaeda, and allied groups are now making a serious comeback here, after spending much of the last decade in the tribal areas of northwest Pakistan.

An impoverished, mountainous country wedged between Afghanistan and China, Tajikistan is also close to northern Pakistan, from which it is separated by only a narrow spur of Afghan territory. Dushanbe, in the western part of the country, is in the Gissar valley, which in turn is surrounded by the Pamir Mountains—the “Roof of the World” that Marco Polo crossed to reach China.

The city was built by the Soviets in the 1920s, following Stalin’s decision in 1924 to separate the Persian speaking southern districts of then-Turkestan from the Turkic speaking areas to the north. Stalin played divide and rule and handed over Bukhara and Samarkand, the centre of Persian culture and history, to Uzbekistan (which shares Tajikistan’s western border) while retaining the poorest part of Persian Central Asia for the new Socialist Republic of Tajikistan.

In recent years, Tajikistan has stagnated under the authoritarian rule of President Emomali Rahmon, who has run the country since 1992. Ninety-three percent of its territory is mountainous and difficult to access. Soon temperatures will drop to minus twenty degrees when icy blasts rush down from the north, and electricity and gas will again be in chronic short supply. Last year, in rural areas, people were deprived of any heating for almost the entire winter.

The economy sputters, fueled not by industry or commerce, but by a vibrant drug trade out of Afghanistan and by remittances sent home from Tajik workers outside the country. Over one million Tajiks out of a population of 7.5 million work elsewhere in the former Soviet Union. Remittances dropped by one third in 2009 because of the Russian recession, but they are picking up again now.

The Tajik capital itself is small and tightly built around the center, and there is only one main drag. It sits on a hazardous seismic zone and in the last century there were more than 500 earthquakes; the city was seriously damaged three times—most recently in 1949—which may account in part for the lack of tall buildings. But Dushanbe always looks better and more prosperous than the poverty that lies just outside the city. Since the last time I was here three years ago, a spanking new luxury Hyatt hotel and several trendy restaurants, mini-hotels, night clubs, and casinos have cropped up. Beautiful Tajik girls dressed in jeans, heels, and tops embroidered with folk art drift in and out of these establishments. One can only imagine that some of them are either related to corrupt government officials or the drug mafias. On the streets everyone else is dressed far more shabbily.

Nor are the casinos and night clubs merely for entertainment: they are the most efficient way for local mafia bosses, who are closely tied to government officials, to launder their money. Corruption is so rampant among the elite that Kabul seems benign by comparison. Thirty percent of Afghanistan’s heroin is shipped through Tajikistan and onward to Russia and Europe.

All of which has made the country a volatile base for militant Islam. Tajikistan’s bloody civil war (1993–97)—distinguished by having the highest number of casualties proportionate to population of any civil war in the past fifty years—was Central Asia’s first experience of militant Islam after the Islamic resistance to the Russian Revolution subsided in 1928.

The civil war was as much between Tajik Islamists and the neo-communist (godless) government, as it was about control of Tajik clans and their territories—a modern ideological struggle wrapped in a medieval one. The war ended with a UN-brokered peace deal that was supposed to force the victor, President Rahmon, to create a coalition government with the Islamists. Instead Rahmon steadily assassinated, jailed, tortured and ousted them from office. At the time of the peace deal in 1997, there were thirty parliamentarians who belonged to the former Islamic Party; there are now only two. Their leader Muhyuddin Kabiri, an old friend from the days when I was reporting on the Tajik civil war, is hanging on to his position by his fingernails and still trying to promote a democratic vision for an Islamic party in Tajikistan.

The key issue today is the extent to which the Taliban, al-Qaeda, and their Central Asian allies such as the Islamic Movement of Uzbekistan (IMU) and its splinter, the Islamic Jihad Union (IJU), are returning to Tajikistan and Central Asia. The much-feared IMU has a long history here: the group’s fighters wrought havoc in Uzbekistan, Tajikistan, and Kyrgyzstan in the 1990s and fought on the side of the Islamic Party in the Tajik civil war. Now, it has a young and ambitious new leader, Usman Adil; its former leaders were killed by US drone strikes in Pakistan. Meanwhile, the Islamic Jihad Union, the break-away faction of the IMU, is being propped up by al-Qaeda. On September 19, its fighters ambushed a Tajik army column in the Rasht valley killing twenty three soldiers.

In retaliation, some forty militants have been killed, according to the government—among them Uzbeks, Tajiks, Kyrgyz, Russians, Pakistanis, Afghans, and Chechens. Central Asia, government officials say, is drawing in militants from all over the region, many of whom have experience in Afghanistan and other conflicts. They see Central Asia as weak and vulnerable, providing an opportunity to set up new bases for global jihad and overthrow the regimes they oppose.

Tajik officials say that Pakistan’s infamous Interservices Intelligence Service (ISI) is behind this new offensive on Afghanistan’s northern border because it wants to deflect attention from the Taliban’s war with the Americans along the Pakistan-Afghanistan border. The ISI denies all such allegations.

Moreover, the deterioration of security in northern Afghanistan, particularly in the provinces of Kunduz, Baghlan, Balkh, and Takhar that border Tajikistan and Uzbekistan, is partly a result of the IMU and other groups building logistic bases there and infiltrating men and materials into Afghanistan. (The IMU does not appear to have an interest in gaining a foothold in Afghanistan, but has shown its support for the Afghan Taliban.) About 8 million Afghans—28 percent of the population—are Tajik, some of them having arrived in Afghanistan after the civil war in the Soviet Union that started after the revolution in 1917 and went on for a decade. Tajiks in both regions speak the same language—a variation on Persian—and have a similar culture, which is more secular than that of the Pashtuns. In the 1980s, the top commander against the Soviets in Afghanistan, Ahmed Shah Massoud, was an Afghan Tajik who helped end the civil war in Tajikistan in 1997, and was assassinated by al-Qaeda just two days before 9/11.

US and Western diplomats are not as pessimistic about the situation in Central Asia as the Tajik offials I spoke to. They say the groups that are active in the Tajik mountains are “local”—i.e. ethnic Tajiks. The main one, which carried out the Rasht ambush, is led by Mulla Abdullo, a legendary Tajik Islamist figure who fought in the Tajik civil war, never accepted the 1997 peace accord in Tajikistan, disappeared to Pakistan, and has now returned. Nobody has seen him in the last decade so nobody knows if it’s really him or an imposter. The other groups are also “local,” they argue, so what we have now in Tajikistan is not an al-Qaeda offensive into Central Asia but a local Islamist reaction to the thuggery, corruption, and poverty-inducing policies of the present regime.

Nevertheless both Tajiks and foreigners concede that it would make perfect sense for al-Qaeda and the Taliban to expand their operations and bases into the weak southern hinterland of Central Asia, which includes southern Tajikistan, Kyrgyzstan and Uzbekistan. These countries are beset with poverty, unrest, growing devotion to Islamic causes, and anger at their governments’ ineptitude. Coming just when NATO forces have announced a timetable to leave Afghanistan, the revival of these militant movements in Central Asia could be extremely dangerous for Afghanistan and the region and allow militancy to spread much beyond the current conflict.

The Russians are the most worried. Central Asia is in their backyard and their long-standing concern that the Afghan heroin trade will spill over into Russia, where there are now several million addicts, is also matched by fears that the long-running Islamist movements in the Caucasus, such as in Chechnya and Dagestan, are linking up to similar movements in Central Asia. Russia fears being ringed by militant Islam.

“The war is moving closer to home,” a very cool-headed Russian diplomat told me at an ambassadors’ lunch in Kabul. “The deterioration of the situation in the north of Afghanistan is very worrisome. We are afraid of terrorism, drugs and extremism coming into Central Asia and then penetrating Russia,” he added.

As a result, the Russian government has been cooperating more closely with the US and NATO in Afghanistan. Russia has promised to help the Americans arm the new Afghan air force with helicopters, and Russian President Dimitri A. Medvedev took part in the recent NATO summit in Lisbon at which he agreed to cooperate with the Americans to contain Iran and al-Qaeda.

But there is no easy solution. The neglect of Central Asia by the big powers, the worsening economic and political crises, and the thriving drug trade all create ideal conditions for the revival of Islamist militancy after the brief spurt that took place in the 1990s. It does not really matter if the extremism is home grown, as the Americans maintain, or if it’s imported from Pakistan and al-Qaeda, as the Tajiks maintain. What is important is that it is there, and if it spreads, it will make any Western withdrawal from Afghanistan much more difficult.