Image copyright EPA Image caption Over a dozen soldiers have been killed in Khyber in less than a month

Just over a month before Nato troops complete their withdrawal from Afghanistan, the Pakistani military is engaged in a fierce operation in the north-western tribal region of Khyber to clear out the militants and secure the country's western border.

The operation, code-named Khyber One, was launched last month to complement a similar clean-up operation, Zarb-e-Azb, launched in June in the North Waziristan region to clean up what many saw as the last major militant sanctuary on Pakistani soil.

During the last six months, the military has taken close to 100 casualties in North Waziristan, most of them in improvised explosive device (IED) attacks.

Over a dozen soldiers have been killed in ambushes and shootouts with militants in Khyber in less than a month.

Image copyright EPA Image caption Families are fleeing Khyber because of the fierce fighting between security forces and militants

Analysts say this underlines not only the determination of the military to clear out the area before the winter snows, but also a desperate response from the militants who are trying to hold on to the last swathes of territory they still control.

Officials say that Operation Khyber One is meant to eliminate the militant threat to the regional capital, Peshawar, which is located nearby, and to protect a major trading route that connects Peshawar with the Afghan capital, Kabul.

It is also designed to plug the influx of a residue of militants holed up in the high-altitude valleys of the upper Orakzai tribal district, Khyber's southern neighbour.

While both Orakzai and Khyber have been housing home grown militant groups, many of them have been affiliated with the Tehreek-e-Taliban Pakistan (TTP) franchise of anti-Pakistan militants who, like many other local, Afghan, Central Asian and Middle Eastern groups had their command and control centre in North Waziristan's Miranshah town.

Most of these groups melted away when the Pakistani military moved in to take physical control of the North Waziristan region in June.

Some groups, like the Haqqani network and their foreign allies, moved north into the Central Kurram region, and also across the border into the Nangarhar province of Afghanistan.

Others, mainly the TTP, took a slightly north-eastward course to penetrate the high altitude Tirah valley, which straddles the Khyber-Orakzai border and has passes leading into Nangarhar.

Aerial bombing

Khyber One is essentially meant to frustrate this influx into Khyber, and to also eliminate their hosts in Khyber - the Lashkar-e-Islam group of Commander Mangal Bagh.

None of these two operations - Zarb-e-Azb in North Waziristan and Khyber One in Khyber - have led to the capture of any prominent militant leaders.

The top leaders of the TTP were already based outside Pakistan, in the border region of north-eastern Afghanistan. Those who ran day-to-day affairs in Miramshah had nearly a month - between the initial aerial bombings that started in early May and the ground offensive that came in mid-June - to manage an orderly pullout from the area.

About the others - such as the local groups led by Hafiz Gula Bahadur, the Mullah Nazir group in South Waziristan, a breakaway faction of TTP led by Commander Sajna, and Haqqani network - analysts doubt that Pakistanis were really keen to eliminate them or arrest their leaders.

Image copyright AFP Image caption Pakistan has carried out intensive airstrikes in the North Waziristan region

They have been mostly operating under peace deals with the military, and have been focusing on fighting inside Afghanistan.

But ever since US President Barack Obama's June 2011 announcement of a withdrawal from Afghanistan, the Pakistani military leadership had been working on their own timetable to secure their borders against a possible reverse flow of militants from Afghanistan into Pakistan, a source close to the military decision makers told the BBC.

The North Waziristan operation was part of that strategy, and the operation in Khyber is a complementary move to clean up a strategically important area of the residual militant groups with an anti-Pakistan agenda.

Raids

If the two operations proceed according to the plan, the military will have put its boots on the ground in almost the entire tribal region along Pakistan's border with Afghanistan.

But the border still remains highly porous, and many in the security establishment fear that Afghanistan and India may use anti-Pakistan groups based in Afghanistan to carry out raids on Pakistani soil.

Analysts believe that to offset this possibility, the Pakistanis are likely to continue to offer selective territorial and other support to Afghanistan-focused groups and elements that have been destabilising Indian-administered Kashmir.

The apparent aim is to work towards a gradual demobilisation of the region's mammoth militant network on the basis of a three-way give-and-take between Pakistan, Afghanistan and India, and possibly involving other powers such as the US and China, they say.

But will it all go according to plan is anybody's guess.