Miranshah is a town in ­Pakistan's tribal region of North Waziristan.

Sitting right on the border with Afghanistan it has always been a hotbed of Islamic militant activity.

Back in the 1980s it was in ­Miranshah that I found myself hidden in a safe house by Afghan mujahideen fighters, waiting to illegally cross the border with them to cover their operations inside Afghanistan against the occupying Russian Red Army.

This week, as part of a Pakistan Army offensive against the Taliban, local journalists were taken to see this frontier outpost.

What they found was a ghost town, the Taliban and townsfolk having long since fled but the militants having left behind evidence of their elaborate arsenal for resistance, including bomb making chemicals and ready-made suicide vests for sale in Miranshah's main market.

Until recently the town was headquarters for the Pakistani Taliban (TTP) and a host of other insurgent groups operating in the region and inside Afghanistan.

As US Secretary of State John Kerry arrives today in Afghanistan to try and resolve a deepening crisis over a disputed presidential election, the Taliban may have fled Miranshah but are as active as ever on both sides of the border.

Afghanistan's political and security landscape is shifting dramatically right now, and the Taliban know it.

For a start, the country has been plunged into political chaos in recent months as a protracted election process to pick a successor to President Hamid Karzai has run into a deadlock between two leading candidates, Abdullah Abdullah and Ashraf Ghani.

Preliminary results from the June 14 second-round run-off put Mr Ghani, a former World Bank official, in the lead with 56.4 per cent of the vote, but Mr Abdullah has rejected the count and his aides have threatened to set up an alternative administration.

Mr Abdullah is of course correct in demanding that charges of rampant electoral fraud be thoroughly investigated, but by calling the election a coup and threatening to establish a parallel government he runs the risk stirring up ethnic tensions and tipping Afghanistan over the edge into another ethnic civil war.

At best what lies ahead now will be a bitter, undignified and potentially volatile transfer of power from the Karzai years that no one is quite sure yet how to resolve. Put another way, it is the very thing Afghans, and the international community, had feared as American troops prepare to leave the country.

Mr Kerry admitted as much yesterday, saying that the United States has enormous concerns for the restoration of the credibility of Afghanistan's election process.

As ever, with their unerring ability for tactical timing, the Taliban have turned the screw militarily. On Tuesday a suicide bomber killed 16 people in Parwan province, north of Kabul.

In southern Zabul province the next day, four policemen were killed by three of their colleagues. The rogue policemen have since defected to the Taliban with guns and a police vehicle.

Then yesterday the Taliban shot and killed six people working for the Halo Trust landmine clearance organisation in western Afghanistan.

As ever it is Afghanistan's civilian population that is bearing the brunt of this latest escalation in violence. This week the United Nations confirmed that the number of civilian casualties in the country jumped by one-quarter in the first half of 2014. Documents show 4,853 civilian casualties, including 1,564 civilian deaths and 3,289 injuries, in the period between January 1 to June 30.

Behind these individual human tragedies, intelligence analysts say the statistics reveal something of a shift in Taliban tactics. Such an increase in civilian casualties caused by ground combat may indicate that the militants are more willing to engage in direct firefights with the Afghan army.

In the past the Taliban would often avoid such direct encounters with well-trained American or coalition troops, relying more on roadside bomb attacks.

Now though, all the signs are that the Taliban is much more willing to take the fight to the less experienced Afghan army.

Over the border in Pakistan meanwhile, the Taliban is facing a renewed offensive which the Pakistani military says will rid the area of the militants and their allies. Few doubt the Pakistani offensive will interrupt the militants' supply lines to their Taliban allies inside Afghanistan itself. But this porous border which tribal and Islamic fighters have exploited for centuries will continue to work to the Taliban's great advantage.

For decades now Taliban fighters have shown themselves to be a flexible force, able to fade away only to regroup and resurface elsewhere. As John Kerry arrives today to make his case for resolving the election crisis he will face a sceptical diplomatic audience. Ordinary Afghans too will be equally sceptical, convinced that only bad times lie ahead with the Taliban.