It’s midnight and I’ve been invited to take part in an online group chat. The group call themselves the Villanelle Elitists. They come from all over the world and they’re here to discuss the TV character that they’re named after: Villanelle, from BBC America’s hit show, Killing Eve.

“We stan one soft assassin.”

“We truly do.”

“She validates us.”

“She’s saved us.”

“She’s our precious, perfect bean.”

That the group “stans” (idolises) a fictional psychopathic killer is strange. That they’re anxious for me to share their feelings is also strange, but I’m glad that they do, because five years ago I created Villanelle.

Earning a living as a writer is hard. Most authors write part-time, and many are only able to do so because they have a supportive spouse or partner. So when I dreamed up the idea of a fiction series based around a female assassin, a project that might tie me up for years, I hesitated. My wife, Nicky, is an art historian, and was then working on a PhD. I was the Observer’s dance critic (still am) with a back-catalogue of politely received but unprofitable novels. Our income was, to say the least, patchy. Was this a risk we could afford?

I’ve always been a thriller fan. At school I read and reread the James Bond novels and remain an Ian Fleming devotee. But the genre has got stale. Say what you like about Bond and his womanising, the man had style. Today’s male thriller heroes are, almost without exception, humourless bores. All those Special Forces fuck-ups and wry, loner cops. All that embittered whisky drinking and late-night jazz. All that technology fetishism. Why not turn the genre on its head? I wondered. Why not have some fun?

Phoebe Waller-Bridge emailed me. 'Oh, god, I looooooved it. It’s suspenseful, dark, cruel, sexy, glamorous, dirty…'

And so was born Villanelle. She came to me all of a piece. I woke up and saw her standing there, fixing me with her icy, sociopathic stare. A child of post-Soviet chaos, as brilliant as she was ferocious, she was employed by an avant-garde global corporation as their in-house murderess. I fell in love with her on sight. Villanelle was very much in my mind when, in June 2013, I went to the launch party of a book by Andrew Rosenheim, then both an author and an editor at Amazon. The online bookseller was launching a new concept, Andrew told me: Kindle Singles – short novels, or novellas, for publication as ebooks. Was I interested? Nicky and I talked it over. She felt as I did: that Villanelle could soar. Go for it, she said.

From that point on my working life divided in two. There were dance critic days, when I went to performances and wrote reviews, and there were Villanelle days, when I plotted mayhem. I published the first Villanelle novella on Amazon in early 2014, and the second the following year. They did well. Readers, especially female ones, were intrigued by my heroine and her would-be nemesis, Eve, the intelligence officer who starts tracking Villanelle and ends up obsessed by her. Both women are brilliant and imaginative, fatally underrated by their male superiors. Both have accepted Faustian bargains. Villanelle is rewarded for her lethal skills with a Parisian flat and limitless funds; Eve has settled for a desk job and a decent and loving husband. Both want more, and circle each other with increasingly reckless fascination.

For a writer, there are advantages to self-publishing. You don’t have to wait a year or more for your book to come out, as you do with a conventional publisher. You get a decent percentage of each sale, and you get it quickly. But it’s lonely out there. Your e-title is one of millions, none of them offering any guarantee of quality. All that you can do is tell people about it and hope that they buy, enjoy and pass the word on. Above all, you need luck, and lots of it. In the spring of 2014, Lyndsey Posner, the managing director of an actors’ and writers’ agency, read my Villanelle novellaand passed it on to a TV production company, which optioned it. An option is a fee paid to secure the rights, for a limited period, to a literary property. For an author it’s the first step on the journey to seeing your work adapted for the screen. And in almost every case the last, as the vast majority of options aren’t exercised. I’d had novels and even magazine pieces optioned before and nothing had come of any of them.

But Sid Gentle Films, set up a couple of years earlier by Sally Woodward-Gentle, whose resumé included producer credits on Whitechapel and Any Human Heart, meant business. I met Sally and her head of development, Henrietta Colvin, and they told me they were determined to turn Villanelle and Eve’s story into a TV series.

Phoebe Waller-Bridge (right), creator of Fleabag and Killing Eve’s scriptwriter, with Sandra Oh (left) and Jodie Comer. Photograph: Lionel Urman/SIPA USA/PA Images

“Although the notion of a female assassin was not unique, Luke’s take was fresh, intelligent and tonally much bolder than others,” Sally said later. “It wasn’t exploitative. We really enjoyed the character of Villanelle and the inventiveness of her kills, but we were particularly engaged with the mutual obsession between the women.”

Sally and I talked about who would lead the script team, and Phoebe Waller-Bridge’s name immediately came up. Her one-woman stage show, Fleabag, had run successfully at the Edinburgh festival and was now at the Soho theatre in London, where I went to see a matinee performance. Phoebe was, and is, brilliant. I loved the wit and fearlessness of her writing and her performance, and after the show I ambushed her at the stage door. We spent the afternoon talking, and the next day, after reading the novella, Phoebe emailed me. “Oh god I looooooved it. It’s suspenseful, dark, cruel, sexy, glamorous, dirty, clinical, epic and immediate all at the same time. Villanelle has captured my imagination completely. Meeting Sally today to rave about it.” In short, she was in.

Over the months that followed, Sally, Henrietta, Phoebe and I met regularly. We talked about the look of the show. About how Villanelle was very visually led, with her beautiful Parisian clothes and artistically composed kills, and how Eve was fashion-blind, domestically chaotic and wholly unaware of her own subtle allure. We talked about the two women’s morbid mutual attraction and the vicious cut and thrust of their relationship. Phoebe would ring me at odd hours with abstract, almost existential questions. On a rare evening off I was fishing with friends, wading waist deep in a Hampshire river, when I felt my phone vibrate. “What does Eve really want?” Phoebe demanded, as I struggled to keep my footing in the current.

I spent most days in front of my laptop, weekends included. Phoebe and Sally needed material, and I needed to keep the novellas coming. I worked later and later at night researching the Russian prison system, or scrolling through Paris designer websites, planning Villanelle’s wardrobe. Nicky helped out, taking time off from her PhD thesis to source workwear for Eve. “I’ve just seen the most hideous twinset in Debenhams,” she’d text me excitedly

The storylining process was enthralling and I felt privileged to be part of the team

Phoebe’s pilot script took shape. It was fast-paced, sexy and very different from anything else on television, with a distinct feminist subtext. The UK channel Sky Living was interested, there were meetings and conference calls, and Sally began to talk about casting. For a time, it looked as if Sky might commission a series. Then, in April 2015, the channel informed us that it had decided to pass on the project. This was a blow, but Sally was undaunted. She decided that we should rework our narrative with more emphasis on Eve. We needed a working title to reflect this development, and for two days we batted ideas backwards and forwards. When I suggested Killing Eve, none of us knew exactly what it meant, but it sounded right. One of the overarching themes of the series is Eve’s discovery of her authentic self. The title suggested this transition and didn’t commit us to actually killing the character off.

By June 2016, Sally was in discussions with BBC America about Killing Eve. The proposal was for a series of eight hour-long episodes, so there was plenty of ground to cover. Weeks of intense, all-day storylining sessions ensued. Vicky Jones, Phoebe’s long-term collaborator, was now on board, and other writers came and went. We met in a room with whiteboards on every wall, all of them covered in Phoebe’s barely comprehensible scrawls and Post-it notes bearing cryptic inscriptions (“Glory Kill”, “Hairpin”, “Dior Cardigan”). At the same time, I was doing my best to keep the dance writing going. I felt like Stalin, planning murder all day and watching Swan Lake in the evening.

The storylining process was enthralling, and I felt privileged to be part of the team. There’s a long history of authors cutting up rough about scriptwriters’ treatment of their books, and producers often keep them at arm’s length. But Sally saw that Phoebe and I were, as she put it, “a great combo”. Phoebe loved and understood the characters I’d created, while I knew that she had to run with the concept and make it her own. Which is not to say that we didn’t have our differences. “She’s left forensic evidence all over the place,” I’d protest at some preposterous Villanelle slaying. “She’d be caught in five minutes.” At which point Phoebe would smile vaguely, wait for me to finish, and carry on as before. And of course she was right. Procedure, in this context, wasn’t the point.

That autumn, things speeded up. One day we were sweating out the series arc in the Sid Gentle office; the next, Sarah Barnett, president of BBC America, was on speakerphone from LA. In mid-October, Killing Eve was greenlit. Phoebe emailed me. “All because you created these EXTRAORDINARY characters and this beautiful complex world they live in!! I’m so happy we finally got it across the line. What fun we will have!!”

The proviso was that Eve had to be American. A succession of actors’ names crossed Sally’s desk, many of them well known, but none of them imaginable in a downbeat London context. None of them was our funny, geeky heroine. And then Sandra Oh, star of Sideways and Grey’s Anatomy, whom we all wanted, but had had other commitments, accepted the part. Variety, the Hollywood trade magazine announced the casting, and insider whispers about Killing Eve began to circulate. We were thrilled to have landed Sandra, but we still needed a Villanelle. In May 2017, Phoebe texted me. “There is a girl called Jodie Comer who gave an awesome taping. Super smart, dangerous, seductive and stroppy.” I watched the screen test. Jodie looked, and sounded, exactly as I had always imagined Villanelle. Poised, clear-eyed, shimmering with threat.

Jodie Comer as Villanelle with Sandra Oh, who plays Eve. Photograph: © Sid Gentle Films Ltd.

On the first day of production we had a read-through of episode one. With the full production team, there were more than 100 of us. The actors sat in a row. Sandra, Jodie, Fiona Shaw, Kim Bodnia (of The Bridge), David Haig, a dozen others. It felt unreal. Afterwards, Sandra and I talked about Eve and her character. “Thanks a lot for giving her such awful fashion sense,” Sandra said wryly. “Jodie gets all these fabulous designer outfits, while I get slacks, sneakers and sockettes.” A fortnight later, Nicky and I visited the set in Paris. It was July, the sun was shining, the cameras were in position, and there was Jodie, as Villanelle, marching through Palais Royal in her scarlet and white Miu Miu dress, blond hair swinging. You get, if you’re lucky, a handful of perfect moments in life. That was one of mine.

Filming continued until December. I visited the set a couple more times, but my part was done. Following an auction, my four original Villanelle novellas had been published as a single full-length novel, Codename Villanelle, and I was working on the sequel. Sandra, it turned out, was a dance fan, and accompanied me to shows at the Royal Opera House and Sadler’s Wells. She would have loved to have been a dancer, she told me. She would have swapped all her acting success for the chance to have worked with the German choreographer Pina Bausch. Watching ballet with her was an unexpected meeting of worlds.

‘Watching ballet with Sandra Oh was an unexpected meeting of worlds’: Luke Jennings, Oh and Akram Khan at a performance of Khan’s Giselle at Sadler’s Wells in 2016. Photograph: Sandra Oh

When Killing Eve aired in the US on BBC America this spring, it was a runaway word-of-mouth hit, increasing its audience by 86% from the first episode, an unheard-of leap in viewer numbers. TV critics were ecstatic, lauding the acting, the writing and the cliche-defying nature of the show itself. Last month it was announced that the series had received two Emmy nominations: for Phoebe’s writing and Sandra’s performance as a lead actress (the first for a performer of Asian descent). Presciently, BBC America commissioned a second series before the first went out. Scripted by actor-writer Emerald Fennell, this is currently being filmed.

As the first series of Killing Eve reached its conclusion, fans of the show began to contact me on Twitter. Most were women, and almost all were LGBT. Their messages were passionate and moving. They claimed the show as their own, they told me. They identified profoundly with Eve and Villanelle, and they felt validated and made visible by the women’s relationship. There had always been a dark romance woven into the narrative, and Phoebe’s script plays up the slow-burn mutual attraction brilliantly (“Cool,” says Eve, her eyes shining, as she gazes at photos of one of Villanelle’s bloodier kills).

While Killing Eve is lent a transgressive edge by murder and psychopathy, it was always about female power and female desire, and for LGBT fans, many of them living troubled and secretive lives, the show had become a refuge, a rallying cry, and a social manifesto. The Twitter messages poured in, couched in the language of fandom, and they all said the same thing: Villanelle, fighting her savage and solitary battle against the world, was their “soft assassin”, and their “precious bean”. She is ours, the fans said, and she is us. My creation had taken on a life of her own, and I couldn’t have been happier.

• Codename Villanelle and Villanelle: No Tomorrow (out in November) are published by John Murray. Killing Eve screens on BBC One and BBC Three this autumn