Last month, the slick intelligence officer I often see lurking around the neighbourhood knocked on my front door. A foreigner had recently been kidnapped, and the spy was doing neighbourhood watch. Kabul-style.

His first suggestion was that I stay at home at all times or get a bodyguard. For a reporter, I protested, neither option was possible.

He shrugged. “I’ve seen you walk around as if you were on a picnic,” he told me.

His second suggestion was that I sign a piece of paper saying I had been warned. Were I to be kidnapped, I understood, I had only myself – not him – to blame.

This wasn’t an isolated incident. A week later, police accosted a friend of mine as she was leaving a dinner. They told her to get back inside until she had acquired a bodyguard. “I don’t even live here,” she exclaimed. No dice. When she assured them she was leaving Kabul the next day, one officer pulled out a mobile phone and made her state her name on video and promise never to return. Job done. We’re here to help.

A worker prays before Iftar, the meal that ends the daily fast during Ramadan. Photograph: Shah Marai/AFP/Getty Images

There’s a sense that Kabul is getting more dangerous. I suppose that’s what the intelligence officer was responding to, in his own way. But it’s not as if foreigners are crowding the streets. Actually, they’re nowhere to be seen.

Tens of thousands of diplomats, soldiers and contractors remain in Afghanistan, but most live like people who have overstayed their welcome, behind blast walls and layers of security. At no point since 2001 has it been more dangerous for westerners in Kabul. At least, that’s the impression you get from observing foreigners here, although doing so is a challenge in itself.

From morning to evening, helicopters clatter across the sky, flying so low that they make my windows rattle. Sometimes, when I tilt my head back, I can glimpse them from my garden, which is directly below a flight path. Sometimes they shoot flares – in lieu of honking horns – which I have to say is a little overdramatic.

British diplomats (with few exceptions) now travel to and from Kabul airport only by helicopter. The road to the embassy – fewer than three miles long – is deemed too dangerous. (The UK embassy refused to comment, citing “security matters”). The US embassy has a similar policy.

An Afghan guard monitors the site of a Taliban-claimed suicide attack in April. Photograph: Massoud Hossaini/AP

It wasn’t always like this. For a decade, Afghanistan attracted adventurers, do-gooders, racketeers and reporters like flypaper. Many got stuck in an intoxicating “Kabubble” of adrenaline and booze. Stories abound of drinking in brothels, drag racing through empty streets at night and making out at Taliban-themed costume parties.

If the expat bubble in Kabul in the 00s was like a pool scene from Boogie Nights, Kabul in 2016 is more like Panic Room.

Take, for instance, one European embassy (which will remain unnamed). One night, its staff were awoken by gunfire. Frantically, they scrambled for the underground safe room. One clenched a gun, another cried in the corner. Their radios were silent. They assumed the security team was busy fighting outside. It turned out Afghanistan had won a big cricket match and half the city was engaged in a little celebratory gunfire. The embassy security team was indeed busy – watching the game.

Shopkeepers in Kabul, a city that is ‘traumatised and crime-ridden’, but also ‘resilient and rebuilding’. Photograph: Massoud Hossaini/AP

This episode is like the cartoon version of why foreign governments fail in Afghanistan: they don’t understand the place. A daily conversation with an actual Afghan might be one place to start.

Diplomats write cables for politicians at home to explain what goes on in the world – or, in this case, the CCTV screen. NGOs here make it almost impossible for foreign staff to go to the field, instead putting them up in downtown Kabul hotels with membership spas and fusion restaurants.

Of course, expat life in Kabul is no picnic, to echo my intelligence officer. Everyone has been spooked recently by stories of kidnappers dressing up in fake uniforms, and by the armed man at a construction site who fired on a UN garden party, killing a Nepalese guard. And no NGO worker I know loves their curfew. Those are employers’ orders.

It’s worth remembering, though, that Afghans – the same Afghans who make this place so strangely enchanting – suffer the vast bulk of the violence.

An Afghan boy carries dough through the streets of Kabul. Photograph: Massoud Hossaini/AP

For them, life slogs on. Kabul is traumatised and crime-ridden, but it’s also resilient and rebuilding. Yes, concrete blast walls are everywhere, and the rancid stench of open sewers is a drawback. But Kabul is much more than this.

How could you not love the street kids who shout “What’s up?” before stopping the traffic and holding the car door open for your wife? Here you’ll find pool sharks gambling hundreds of dollars; old men on street corners writing love letters on request; young women organising street protests; proud coppersmiths; millionaire kleptocrats and philanthropists; poets and rappers; one Jew (reportedly); and the best jokes about Pakistan you’re likely to hear.

The mosque in front of my house booms anti-western sermons, but bodybuilders at the nearby gym kiss my cheeks and bench-press with 50 Cent on the stereo and Shakira – lots of Shakira – on the TV.

Kabul is a city finding its identity in a time of transition, and we who are here to witness it should consider ourselves lucky.

Sune Engel Rasmussen is the Guardian’s Afghanistan correspondent. He won the New Voice award at the One World Media awards last month