“They are afraid of a lot of things now. They are afraid of the bombing, they are afraid of the attack that’s coming and they are also really afraid of the foreign spies who are among them”. This was Rachid’s description of what was going on inside Isis. And the Western intelligence agency that has infiltrated Isis the most, claimed the Belgian jihadi, was the British.

Rachid is one of the thousands of foreign fighters who had gone to join Syria’s jihad, graduating in extremism among rebel groups to two years serving with Isis. But disillusioned, he says, with the Islamists and fearing what lay ahead, he has fled across the border to Turkey.

Rachid, a mechanic before he took up the gun in the name of Islam, was part of a small but steady flow of fighters leaving Isis as it faces an assault on Mosul, its last stronghold in Iraq and waited for the coming offensive against Raqqa, the capital of its “caliphate” in Syria.

The contact with Rachid came through an intermediary in Turkey after I wrote an article in The Independent last month about thousands of jihadis from who, with Isis facing defeat, will be seeking to return. The picture painted by him was of an “Islamic State” where the sense of omnipotence that came during the astonishingly quick advance through Syria and Iraq has been replaced by foreboding, divisions and desertions. And with it has come rising paranoia and violent retribution being exacted on those deemed to be traitors.

Rachid, who had trimmed his beard and burned the clothes and documents he had in Syria, was anxious to leave Urfa, the city where we met, as soon as possible. It has, despite being in Turkey, become a haven for Islamist extremists, including those from Isis.

Moderate activists have been murdered in Urfa, among them Ibrahim Abdul Qader and Fares Hamadi, who were members of the group Raqqa Is Being Slaughtered Silently, which charts the brutality of Isis. A video posted by Isis of the killings claimed the victims had “conspired with crusaders”. There is no evidence that any of these activists had links with British or other intelligence agencies.

In pictures: Mosul offensive Show all 40 1 / 40 In pictures: Mosul offensive In pictures: Mosul offensive A doctor carries an Iraqi newborn baby at a hospital in Mosul, Iraq July 18, 2017. Reuters In pictures: Mosul offensive Iraqi girls play at a yard of a school in Mosul, Iraq July 18, 2017alal Reuters In pictures: Mosul offensive A woman on crutches who is a relative of men accused of being Islamic State militants is seen at a camp in Bartella, east of Mosul, Iraq July 15, 2017. Picture taken July 15, 2017. Reuters In pictures: Mosul offensive A displaced girl, who fled from home carries a doll at Hamam al-Alil camp south of Mosul, Iraq July 13, 2017. Reuters In pictures: Mosul offensive Iraqi federal police members and civilians celebrate in the Old City of Mosul on 9 July 2017 after the government's announcement of the "liberation" of the embattled city. Iraqi Prime Minister Haider al-Abadi's office said he was in "liberated" Mosul to congratulate "the heroic fighters and the Iraqi people on the achievement of the major victory" AFP/Getty Images In pictures: Mosul offensive A picture taken on 9 July 2017, shows a general view of the destruction in Mosul's Old City. Iraq will announce imminently a final victory in the nearly nine-month offensive to retake Mosul from jihadists, a US general said Saturday, as celebrations broke out among police forces in the city. AFP In pictures: Mosul offensive Members of the Iraqi federal police raise the victory gesture as they ride on a humvee while advancing through the Old City of Mosul on 28 June 2017, as the offensive continues to retake the last district held by Islamic State (IS) group fighters. AFP/Getty Images In pictures: Mosul offensive Smoke billows as Iraqi forces advance through the Old City of Mosul on 26 June 2017, during the ongoing offensive to retake the last district held by the Islamic State (IS) group. AFP/Getty Images In pictures: Mosul offensive An Iraqi man wearing the green scarf of the Shi'ite faith kisses an Iraqi Army soldier on safely reaching the Iraqi forces position as Iraqi civilians flee the Old City of west Mosul where heavy fighting continues on 23 June 2017. Iraqi forces continue to encounter stiff resistance with improvised explosive devices, car bombs, heavy mortar fire and snipers hampering their advance. Getty Images In pictures: Mosul offensive A picture taken from the inside of an Iraqi forces armoured vehicle shows residents walking through a damaged street as troops advance towards Mosul's Old City on 18 June 2017, during the ongoing offensive to retake the last district still held by the Islamic State (IS) group. Military commanders told AFP the assault had begun at dawn after overnight air strikes by the US-led coalition backing Iraqi forces. They said the jihadists were putting up fierce resistance. AFP/Getty Images In pictures: Mosul offensive Iraqi Army soldiers advance in a destroyed street after an Iraqi forces airstrike targeted an Islamic State sniper position 17 June 2017 in al-Shifa, the last district of west Mosul under Islamic State control. IS snipers, as well as car and suicide bomb attacks continue to hinder the Iraqi forces efforts to retake the final district. A series of airstrikes by Iraqi helicopter gunships attempted to hit multiple Islamic State sniper positions in al-Shifa. Getty Images In pictures: Mosul offensive An Iraqi soldier frisks a displaced Iraqi man at a temporary camp in the compound of the closed Nineveh International Hotel in Mosul on 16 June 2017 which was recovered by Iraqi troops from Islamic State group fighters earlier in the year. A screening centre set up in the compound's fairgrounds sees a constant stream of Iraqis fleeing the battle for Mosul, awaiting their turn to be checked by the Iraqi forces who are searching for suspected Islamic State (IS) group members. The small fairground lies at the end of a pontoon bridge across the Tigris recently opened to civilians that is the only physical link between the two banks of the river. AFP/Getty Images In pictures: Mosul offensive Iraqis staying at the al-Khazir camp swim in a river near the camp for internally displaced people, located between Arbil and Mosul on 11 June 2017. AFP/Getty Images In pictures: Mosul offensive Iraqi government forces drive on a road leading to Tal Afar on 9 June 2017, during ongoing battles to retake the city from Islamic State (IS) group fighters. AFP/Getty Images In pictures: Mosul offensive An Iraqi policeman carries a poster bearing an image of Mosul's iconic leaning minaret, known as the "Hadba" (Hunchback), on 22 June 2017. AFP/Getty Images In pictures: Mosul offensive Iraqis stand in line to receive food aid in western Mosul's Zanjili neighbourhood on 7 June 2017, during ongoing battles as Iraqi forces try to retake the city from Islamic State (IS) group fighters. Living conditions in Mosul have again deteriorated since the start of the Iraqi government's offensive on the city in October in which they retook a large part of the west of the city. AFP/Getty Images In pictures: Mosul offensive Displaced Iraqis carry lightbulbs and sacks as they evacuate from western Mosul's Zanjili neighbourhood as government forces advance in the area during their ongoing battle against Islamic State (IS) group fighters on 13 May 2017 AFP/Getty Images In pictures: Mosul offensive A member of the Iraqi Counter-Terrorism Service (CTS) flashes the victory gesture as he patrols in western Mosul's al-Islah al-Zaraye neighbourhood on 13 May 2017 AFP/Getty Images In pictures: Mosul offensive Iraqi army soldiers from the 9th armoured division on a truck flash the sign of victory as they drive back from Mosul to the town of Qaraqosh (also known as Hamdaniya) Getty In pictures: Mosul offensive Members of Iraqi forces flash the sign of victory on their vehicle as they advance towards Hammam al-Alil area south of Mosul Getty In pictures: Mosul offensive A member of Iraqi security forces gestures in Hammam al-Alil, south of Mosul, Iraq Reuters In pictures: Mosul offensive Iraqi children, one flashing the sign of victory, greet Iraqi army's soldiers from the 9th armoured division in the area of Ali Rash, adjacent to the eastern Al-Intissar neighbourhood of Mosul Getty In pictures: Mosul offensive Peshmerga forces look at a tunnel used by Islamic State militants near the town of Bashiqa, east of Mosul, during an operation to attack Islamic State militants in Mosul, Iraq Reuters In pictures: Mosul offensive An Iraqi soldier takes a photograph with his phone as his comrade stands next to a detained man, whom the Iraqi army soldiers accused of being an Islamic State fighter, who was fleeing with his family in the Intisar disrict of eastern Mosul, Iraq Reuters In pictures: Mosul offensive Iranian Kurdish female members of the Freedom Party of Kurdistan (PAK) hold a position in an area near the town of Bashiqa, some 25 kilometres north east of Mosul Getty In pictures: Mosul offensive Iraqi families, who fled their homes in Hamam al-Alil, gather on the outskirts of their town Getty In pictures: Mosul offensive Displaced people walk past a checkpoint near Qayara, south of Mosul, Iraq AP In pictures: Mosul offensive Iraqi families who were displaced by the ongoing operation by Iraqi forces against jihadists of the Islamic State group to retake the city of Mosul, are seen gathering in an area near Qayyarah In pictures: Mosul offensive A boy who just fled Abu Jarbuah village is seen with his family at a Kurdish Peshmerga position between two front lines near Bashiqa, east of Mosul, Iraq Reuters In pictures: Mosul offensive An Iraqi child eats a pomegranate upon the arrival of Iraqi forces in the village of Umm Mahahir, south of Mosul Getty In pictures: Mosul offensive People who just fled Abu Jarbuah village sit as they eat at a Kurdish Peshmerga position between two front lines near Bashiqa, east of Mosul, Iraq Reuters In pictures: Mosul offensive A couple who just fled Abu Jarbuah village are escorted by Kurdish Peshmerga soldiers Reuters In pictures: Mosul offensive Women carry a boy over a wall as civilians flee their houses in the village of Tob Zawa, Iraq AP In pictures: Mosul offensive An Iraqi soldier and a civilian ride a motorbike as smoke rises behind them, on the road between Qayyarah and Mosul Getty In pictures: Mosul offensive A member of Iraqi forces, wearing a skull mask, waits at a checkpoint for people fleeing the main hub city of Mosul Getty In pictures: Mosul offensive An Iraqi soldier sits at a checkpoint in an area near Qayyarah Getty In pictures: Mosul offensive Iraqi men prepare food portions for Iraqi forces deployed in areas south of Mosul Getty In pictures: Mosul offensive Iraqi forces celebrate upon the arrival of vehicles bringing food to them Getty In pictures: Mosul offensive Iraqi childen smoke cigarettes upon the arrival of Iraqi forces in the village of Umm Mahahir, south of Mosul Getty In pictures: Mosul offensive A member of Iraqi forces distributes drinks to children in the village of Umm Mahahir, south of Mosul Getty

Many of those killed across the border, however, have been accused of being foreign spies. One of the most high-profile figures was Abu Ubaida Almaghribi, head of Isis’s security for Aleppo, who was in charge of James Foley, the American photojournalist, and other Western hostages before they were murdered. Almaghribi, a Dutch national of Moroccan descent, and three others were said to have been beheaded after being accused of being MI6 agents and passing on secrets to the UK.

Isis held an internal investigation after British national Mohammed Emwazi, who murdered James Foley and other captives, including Britons David Haines and Alan Henning, was killed in another drone strike last November. A purge and executions followed claims that his location had been betrayed, enabling the successful air strike to be carried out.

Rachid and other European jihadis face the prospect of long prison sentences if they returned home. The only European state that does not charge returnees from Syria’s rebel groups with terrorism related offences is Denmark, which runs a rehabilitation programme .

Mosul battle: Civilians flee ahead of fighting

The foreign fighters were convinced, said Rachid and other fighters, that the Western security agencies are tracking them after placing agents inside Isis and other Islamist group. They are also convinced that Britain has taken a leading role in this. “The British are not the biggest group of volunteers from a country [in Europe]. But maybe because some of those who came from there became so well known that their intelligence service is so involved. But many brothers will tell you that spies are active, Daesh [Isis] have killed men, women even, after saying they were foreign spies, some of them British spies,” said Rachid.

“Daesh asked for a lot of people, not just fighters, but teachers, engineers, doctors to build the Islamic State, if you remember. They now think that a few of these spies got in at that time,” he added.

Uluk Ultas, a Turkish academic and political analyst who is writing a book on Syrian rebels was also aware of the “British connection”. He said: “There is a pretty widespread feeling that the UK has managed to infiltrate a number of groups, including Isis, and that the Isis leadership was aware of this and worried. I was surprised when I was first told this, because I thought it would be the Americans who would be taking the lead in this among the Western countries, but it seems the British have been working on this for a while, don’t forget Almaghribi was arrested by Daesh two years ago.”

Mr Ultas is the director of Seta, a think tank which was founded by Ibrahim Kalin, an adviser to President Recep Tayyep Erdogan. His book will contain a rare interview with Abu Firas al-Suri, a senior leader of Jabhat al-Nusra who was subsequently killed in a US drone strike.

He continued: “What is interesting is that as Daesh [Isis] got bigger the checks it made on those wishing to join became less strict. It seems the feeling in the leadership was that since they were no longer just a fighting group, but the Islamic State, they were somehow above it and that their security would find enemy agents.

“But it seems they were not so successful and Western intelligence and others like the Turkish and the Jordanian were able to get in there. Almaghribi was the most high profile of those Daesh called a British spy and said they killed. But I have spoken to fighters who say that Almaghribi isn’t dead after all and has been seen around. Maybe he’s being held as a bargaining counter for when Raqqa falls – who knows?”

Isis releases video claiming everything is fine in Mosul

Some of the information about Almaghribi came from Jejoen Bontick, who was, like Rachid, a Belgian jihadi. He had stated that James Foley and his fellow hostages were being held by Belgian jihadis who belonged to a group called Sharia4Belgium in Aleppo. They were later moved to Raqqa and into the hands of Emwazi and three other Britons, who became known to their captives as The Beatles (Emwazi was known as “Jihadi John”).

Philip Balboni, the chief executive of GlobalPost, the American news organisation for which Foley worked, had said of Bontick: “A young Belgian who had travelled to fight in Syria befriended Foley and, once that jihadist went back to Belgium, offered excellent information on roughly where Jim was held and by whom. It was the first time we knew that Jim was alive.”

Bontinck was a member of Sharia-4-Belgium. It’s leader Fouad Belkacem, a convicted burglar, visited England in 2010 and met Anjem Choudary, the London-based radical Muslim preacher for advice before starting the group in Brussels. Choudary was jailed for five and half years in London last month after being convicted of supporting Isis.

Some Sharia-4-Belgium members subsequently visited Choudary and worked with him in London: some of the preacher’s followers went in turn to Belgium. Choudary, who represented fundamentalist British Muslim groups Islam4UK and al-Muhajiroun, gave his support to Sharia4Belgium through a website called Paltalk. It was also used by Omar Bakri Mohammed, another radical preacher who was expelled from the UK. After the murder of Lee Rigby, Bakri Mohammed told The Independent that one of the killers, Michael Adebolajo, used to be part of his congregation.

Sharia4Belgium founder Belkacem has been jailed for 12 years in Belgium, Boninck received a suspended sentence after testifying against others, many of them members of the organisation, accused of terrorist offences,

Around 27,000 foreign fighters are believed to have joined Isis since the start of Syria’s civil war five years ago, with between 5,000 and 7,000 of them arriving from Europe to join Isis and other hardline Salafist groups such as Jabhat al-Nusra – an al-Qaeda affiliate that now calls itself Jabhat Fatah al-Sham. Just under 800 have travelled from the UK, but the numbers coming back have been fewer than a dozen for the past nine months.