RIGHT now I’m living in a city of walls and barriers. Concrete blast walls, razor wire, checkpoints and sandbagged emplacements. Never far away are the men with guns, be they soldiers, policemen, militiamen belonging to myriad warlords or those security guards tasked with protecting me in the compound where I stay. This is life in the Afghan capital of Kabul today.

All are testimony to the threat posed by both the Taliban and Afghanistan’s affiliate of the Islamic State (IS) group – the Islamic State of Khorasan Province (ISKP), as they are known here.

Venturing on to Kabul’s streets to do my work as a journalist means needing to be constantly vigilant. Should I stop to take photographs or interview someone my “minder” is always nearby, watching every passing individual or vehicle that might pose a potential threat.

Kabul is a frontline, but it’s a strange kind of frontline. One that cannot be clearly recognised or demarcated and where the “enemy” sometimes lurks among the “ally”.

Only this week a major study published by the think tank Global Peace Index gave Afghanistan the dubious ranking of the world’s least peaceful country. It is now “the world’s most violent conflict with the highest number of deaths from war and terrorism”. It replaces Syria at the bottom of the index, which is now the second-least peaceful country in the world, followed by South Sudan, Yemen and Iraq.

While IS might have lost its caliphate in Syria and Iraq, now in the forbidding mountains of northeastern Afghanistan its affiliate ISKP is expanding its footprint, recruiting new fighters and plotting attacks on the United States and other Western countries, according to US and Afghan security officials.

Today, ISKP numbers thousands of fighters, many from Central Asia, but also from Arab countries, Chechnya, India and Bangladesh, as well as ethnic Uighurs from China. Only this past week one Afghan official predicted that the province in which he lives and works would soon replace the Middle East as IS’s centre of gravity.

“Right now in Kunar Province, the right side of the road is Taliban, the left side is Daesh, and the government is in the middle,” he said, referring to the group by its Arabic acronym. Indeed, such is the growing threat ISKP poses that some officials – both Afghan and international – now see the Taliban as a potential partner in containing them.

This might come as a surprise to many people unfamiliar with the current political climate in Afghanistan, but the reality here now also speaks of a Taliban keen to present itself as a different kind of entity.

While in the Gulf state of Qatar they engage in peace negotiations with the US, here on the ground they seem more determined to win the hearts and minds of locals in areas where they rule and prove themselves capable of playing a full role in Afghanistan’s governance.

Talk to many Afghans in Kabul and they will tell you that in shaping the country’s political future the Taliban simply cannot be ignored.

Sensing this, the Taliban is pulling out all the stops to reinvent themselves. Just a few days ago in a scene like something from a Tom Clancy spy thriller, my Afghan fixer arranged for me to talk by phone to leading Taliban spokesman Zabiullah Mujahed.

Despite the Taliban’s more “accommodating” position these days, setting such things up is not easy. Fears on both sides of being tracked result in making such calls from anonymous locations, sometimes on the move in a vehicle, and the use of disposable SIM cards and “burner” mobile phones.

Among the questions I put to Zabiullah was whether the group was willing to share power in any future governance of Afghanistan. I asked him too whether the Taliban now saw ISKP as an ally or rival and a threat and possible hindrance to their peace negotiations with the US.

Canny and eloquent, he maintained that a full withdrawal of US-led international coalition troops remained a precondition for any willingness on the Taliban’s behalf to end its armed insurgency. Zabiullah made it unequivocally clear that already the Taliban were, in places, engaged in a turf war with ISKP, but insisted that they were a limited force and no threat to the Taliban.

Pushing him on this issue and what might happen if ISKP did become a major problem, he left little doubt that the Taliban would not allow their rival jihadists to undermine any future political plans they might have for power sharing in the country.

While negotiations between the US and the Taliban have right now momentarily stalled, it’s a measure of how determined the Afghan Government are to keep the talks open that this week it freed hundreds of Taliban prisoners without conditions and expressed a willingness to free hundreds more.

This in itself is a big risk given that, historically, Taliban prisoners who have been freed from Afghan prisons have returned to the battlefield.

So far, the Taliban has not responded to the prisoner release, and has consistently labelled the “Kabul administration” as “impotent”, a “stooge” of the US and the West and other derogatory names – let alone negotiate with it.

But despite this, it’s hard not to see a significant shift slowly taking place in how the Taliban perceive their future political role in this long-suffering country. Challenging as the security situation remains, one can’t help but sense a flicker of hope here that after nearly four decades of fighting that started back in the 1980s when Afghanistan became embroiled in the war with the then Soviet Union, some semblance of peace might yet come about. There remain wild cards, of course, not least the growing violent presence of ISKP.

Speaking to ordinary Afghans I can’t help sense too the frustration they feel in being caught between a rock and a hard place, with the Taliban on one side and what many perceive as a corrupt government of elites and warlords on the other.

Perhaps sensing this, the Taliban will doubtless continue pressing home their case that they are fit and capable of helping govern Afghanistan. Only time will tell though whether indeed the “new” Taliban approach is just that or only a smokescreen for aims and outcomes that remain no different than before.

For the moment, Afghanistan’s population remains in the grip of war, and here in Kabul they will continue to live in a city of walls and barriers while foreigners like myself constantly look over our shoulders.