In early September, when David Cameron told the House of Commons a Royal Air Force drone had killed three fighters from the so-called Islamic State, or Isis, in Syria, he said it was the first such attack in a country where Britain was not at war. It was also unusual in that the primary target of the attack, 21-year-old Reyaad Khan, was a British citizen, born and raised in Cardiff.

An unmanned drone controlled by pilots at an RAF base in Lincolnshire, more than 4,800km away, tracked Khan as he travelled in a vehicle outside Raqaa, the de facto Islamic State capital in Syria. When they judged the moment right, the pilots in Lincolnshire struck, firing a Hellfire missile at the vehicle, killing Khan and his two companions, one of whom was another British citizen, Rahul Amin.

Cameron said Khan had been targeted because he was actively recruiting Islamic State sympathisers and “directing a number of planned terrorist attacks right here in Britain”, such as plots to attack high-profile public commemorations.

“We took this action because there was no alternative. In this area, there is no government we can work with; we have no military on the ground to detain those preparing plots; and there was nothing to suggest that Reyaad Khan would ever leave Syria or desist from his desire to murder us at home, so we had no way of preventing his planned attacks on our country without taking direct action,” the British prime minister said.

Khan had won notoriety a few months earlier when he appeared in an Islamic State propaganda video called There is no Life without Jihad, alongside his school friend Nasser Muthana, who had also left Cardiff for Syria in November 2013. Muthana’s younger brother Aseel, who was just 17, followed three months later.

The video shows Khan and Muthana dressed in fatigues and sitting cross-legged with other fighters around a campfire, with Khan, his baby-face features framed in a black and white check keffiyeh, cradling an assault rifle as he urged other British Muslims to follow his path.

"This is a message to the brothers who stayed behind. You’ve got to ask yourself what prevents you . . . from joining the ranks of the mujahideen, those that spilled their blood?” he says in the video.

“What prevents you from attaining martyrdom and the pleasure of your Lord? Look around you, while you sit in comfort, and ask yourself, is this how you want to die.”

Khan’s killing provoked little outrage in Britain, but within Cardiff’s close-knit Muslim community, many are still puzzling over just what made this gifted, straight-A student sacrifice his life for the nihilistic ideology of Islamic State. Others are wondering if Khan’s friends, the brothers Nasser and Aseel Muthana, could be next on the RAF’s kill list.

Khalid Rahman, now a 21-year-old computer science student at Cardiff University, went to school with Khan, and the two boys played football together every Sunday in a local park.

“It was a group of boys that we would go together with. It was me, him, we’d take my friend’s younger brother, who was, like, 10,” he says. “Honestly he was a very nice quiet lad. He was studying like any other student would, and he had a lot of future goals.”

Among those goals was to become Britain’s first Asian prime minister, according to a message Khan posted on Facebook, in October 2010. In a video for a local community group the same year, which was discovered last year by the Guardian newspaper, Khan spoke about the need for politicians to engage more with young people to prevent them from going down “the wrong path”. Asked if he thought the world was a good place, he replies: “The world can be a lovely place, but you’ve just got to get rid of the evil.”

The young man in the 2010 video comes across as bright, articulate and idealistic, if a little melancholy and vulnerable. There is no evidence there of unusual religious fervour, but his friend Rahman recalled that, when they were playing football as teenagers, Khan was more devout than most.

“Even then he did have this religious aspect because he would also tell us to pray on the field and stuff, but you wouldn’t see that, like, it wouldn’t be extreme. It was just, like, it’s time to pray, so we’d pray. We’d do the ritual to wash ourselves with water and then we’d pray. It would be normal, like,” says Rahman.

Khan’s radicalisation appears to have coincided with his attendance at Cardiff’s Al Manar mosque, which hosted preachers from the fundamentalist Salafi movement. Salafism, synonymous with Saudi Arabian Wahhabism, is the ideological foundation of groups like Islamic State, al-Qaeda, the al Nusra Front and Boko Haram. Nasser Muthana started attending Al Manar about the same time as Khan, abandoning the South Wales Islamic Centre, a mosque near his home in Cardiff’s Butetown.

“Every major arrest in Cardiff city has one thing in common. The only thing they have in common is the mosque that they went to,” says Sheikh Zane Abdo, the Liverpool-born imam at the South Wales Islamic Centre and an outspoken critic of radical preachers.

“These boys in Cardiff, the Muthana brothers and Reyaad Khan, they left the traditional understanding of Islam that their parents were brought up in and sort of gravitated towards the Salafi Islam.”

Mohamad Ahmed grew up close to the Muthana brothers and was the same age as Nasser but he knew both of them well. They spent time in each other’s houses and watched movies together, and although they all came from a Yemeni background, they were all born in Cardiff.

“They were normal guys, normal, just normal guys. They liked football teams, supported football teams, watched movies, did guy things, you know, things that guys do. They grew up here, I grew up here. We’re westernised, you know, we do normal things,” says Ahmed.

“You know, I loved, I loved, I really did love Aseel and Nasser. They were good friends, like any other guys here. But obviously something happened later on in life when I wasn’t there that pulled them away.”

Nasser did well at school, and before he left for Syria he had won a place at medical school. But Zane says it was obvious just to look at him that something had changed.

“I saw Nasser a year before he left,” says the sheikh. “And he just looked militant. The guys he hung out with too. He was dressed in pants and stuff, he looked like the classic al-Qaeda and Isis fighter in a cave. That’s how he looked, in a way that extremists look, militant.

“Aseel grew his hair the months before he left too. We could see the change physically. When Aseel came to the mosque one day I looked at him and I thought: Oh my God, he has gone on that road too. We saw these boys and the way they looked like Isis soldiers, you could just tell.”

Ahmed, a tall, soft-spoken engineering student who spent a year studying Islam in Yemen, could see Nasser had fallen under the influence of Salafi preachers. Some of their adherents had tried to persuade him, too, to stay away from the moderate Sheikh Zane Abdo and come to Al Manar, but he ignored them. He was determined, however, to prevent Nasser’s younger brother Aseel from following the extremists.

“I could see it in Aseel. I saw the type of people he starting speaking to. I told him: ‘Look, if there was an issue, I can explain it to you.’ I went back to the sheikh and said: ‘Look Aseel is watching this, heard this, how do I reply? What is the traditional answer here? These guys are trying to brainwash him.’ And you know, sadly, eventually they did brainwash him and pulled him on their way,” he said.

Zane says young British Muslims are drawn to radical ideas out of a real sense of outrage about the suffering of Muslims elsewhere, particularly in Syria. Instead of considering practical, peaceful ways to help those who are suffering, or to influence western policy, they are attracted by the extremist message. He thinks he never had much hope of persuading Nasser, who stayed away from his mosque and passed several others on the way to attend Al Manar. But he had hopes for Aseel.

“I think Aseel was caught in between. He was coming to my mosque. He was one of my brightest students and he stayed for about a year, and you had other people pulling him away. A year later after he was going there, he was already watching jihad videos. A lot of boys watch jihadi videos. It’s like people watch pornography,” he says.

Rahman remembers clearly the moment he heard Khan had gone to Syria. It was a few months after the two had last met, at an ice-cream parlour one night during Ramadan.

“I was sitting with my headphones, playing a game on my phone, when my friend said, ‘Yo bro, have you heard, Reyaad Khan went to Isis.’ And I said, ‘What?’ I literally had goose bumps.

“That night he told his sister that he was going and he was not coming back. That’s it, and he said, ‘You can have my laptop, you can have my room, I’m going.’ He didn’t even say goodbye to his parents or anything.”

Nasser Muthana didn’t tell his parents either. His father had given him £100 to attend a religious course in Shrewsbury, but instead he flew to Turkey and then crossed into Syria. Police believe both Khan and Muthana received help in planning their journeys.

Rashad Ali became involved with the extremist Islamist group Hizb ut-Tahrir when he was 14 and was part of it for almost a decade, rising to a leadership position before he turned away from its ideology. Now a senior fellow at the Institute for Strategic Dialogue, he works with young people who have been drawn to extremist ideology and helps them to remove themselves from radical groups.

He says most young people who have travelled from Britain to join groups like Islamic State have engaged with extremists both online and offline, receiving practical advice online.

“There’s online interaction where people are giving them guidance, specifically on where to go, which airports to travel from, which ones are monitored, which ones are not, or less apparently. How to not let your family and friends and school know this is happening,” he says.

“So they explicitly tell them: do things like plan holidays with your parents, so they think everything is fine and you’ve got future plans. Make clear you have future plans at your school so there’s no hint that you’re leaving the school.”

Ali approached the Muthana brothers’ father after Nasser left, offering to help him prevent Aseel from following him to Syria, but the offer was rejected.

“The police tried, we tried, I spoke to him. But he was adamant. We tried to explain to him that we know the situation, we work with kids in this scenario and try to help them. Then he was really upset when his son left. He was genuinely upset,” he says.

Among the striking features about the ideology surrounding groups like Islamic State is its mix of the medieval with the 21st century, with a modern concept of the state blended with a pre-modern idea of empire. For Ali, a key to understanding groups like Islamic State is to see the central role of their political vision, as well as the religious one.

“The way to try and understand it is that they’re not trying to revive some kind of puritanical, perfect, Islamic utopia, in the way we would see it. What they are trying to do is revive the Dark Age period of politics, which is one of kings, battles, warfare as the norm, expansion of empire, capturing land, dominion, conquest, enslavement, pillaging, etc,” he says.

Sharp videos, slick media and iconography drawn from computer games help to make Islamic State accessible to a young generation of 16- to 24-year-olds brought up on computer games.

“I don’t think it’s the computer games themselves that give that stimulus and motivation; I’d be very reluctant to say that. I think it’s the politics, the pre-modern nature of their worldview and the strong religious ideology pushing them and their very strange connection of piety, modernity and, yes, their culture, which is this kind of Game of Thrones and Call of Duty coming together to make this culture,” says Ali.

“You’ve got to remember, they’ve attracted thousands of Europeans, arguably almost 1,000 British people. The French authorities reckon 10 people from Paris every week. We’re talking about literally thousands of people from Europe: a whole army from Europe has gone.”

Reyaad Khan’s tweets from Syria are a mixture of the bloodthirsty and the juvenile, boasting about killing prisoners and joking about the beheading of an American journalist: “The brother that executed James Foley should be the new Batman.”

A month before he was killed, he posted pictures of bloated and mutilated corpses with the message: “JN guys we caught & executed. This is how they looked less than an hr l8er.” Another tweet showed a picture of an assault rifle with the caption: “Check this little bad boy out,” and in another, he asked: “Anyone want to sponsor my explosive belt? Gucci give me a shout.”

It was, however, the skilfully produced video around the campfire, featuring both Khan and Nasser Muthana, that brought both of them international notoriety. Here, according to Zane, was their chance to be somebody.

“They look around the street and they’re nobody,” says the sheikh.

“But now, all of a sudden, they’re in this video, around the campfire and they’re broadcasting to millions of people watching. And literally I would say they were nobody in our city, nobody paid much attention to them. And now they’ve gained that fame, they’re notorious for all the wrong reasons,” he says.

Numerous questions remain about the British government’s extrajudicial killing of Reyaad Khan, not least whether it was legal. The government claims it was acting in self-defence, citing Khan’s involvement in planning terrorist attacks in Britain to coincide with various commemorations. But all the events cited, which included the anniversary of VJ Day, the victory over Japan in the second World War, had already passed by the time Khan was killed on August 21st.

Former attorney general Dominic Grieve told the BBC the killing was likely to provoke a legal challenge.

“It is a very draconian thing to do. After all, the European Convention on Human Rights and the Human Rights Act give a right to life, and the United Kingdom should not interfere with that lightly. I very strongly suspect, given that this man was a British national with family in this country, it will probably lead to a legal challenge in due course,” he said.

Back in Cardiff, there is little sympathy for Khan, even from Zane, who says he was shocked and disappointed by his death.

“He made a decision to go and fight. And he knew what he was doing and what the consequences were. No doubt he wanted a fate that he reached. He wanted martyrdom. For us, of course, this is not martyrdom, but this is a whole other issue.

“He is a young boy from here, yes that is uncomfortable. But at the same time, he is working with the enemy. We can not get away from that . . . If you are batting for the wrong team you must expect repercussions that come back at you for your decisions. You have to live with these decisions,” he said.

Mohamad Ahmed is firmer still, suggesting the killing of Khan – and perhaps of the Muthana brothers in the future – could be a price worth paying if it prevents other young British Muslims from joining Islamic State.

“Reyaad became, along with Nasser, the posterboy for Isis in the west. I’m not sure that I am allowed to say this, but the destruction of one person to maybe save hundreds is a sacrifice. A lot of people may have been attracted to go to Isis because of these three boys. But maybe without these three a lot of westerners would not have gone. I have a lot of friends who I don’t want to go to Isis. I don’t want any other boys or relatives to go,” he says.

“I heard these guys were calling on Twitter to join Isis. I thought: get rid of these guys for the benefit of the rest. I care about the majority. I cared about Aseel when he was here. But the fact that he is pulling other people with him – no, forget him.”