On 5 February, Jordanian officials confirmed that the intellectual godfather of al-Qaida, Abu Muhammad al-Maqdisi, had been released from prison. Though he is little known in the west, Maqdisi’s importance in the canon of radical Islamic thought is unrivalled by anyone alive. The 56-year-old Palestinian rose to prominence in the 1980s, when he became the first significant radical Islamic scholar to declare the Saudi royal family were apostates, and therefore legitimate targets of jihad. At the time, Maqdisi’s writings were so radical that even Osama bin Laden thought they were too extreme.

Today, Maqdisi counts the leader of al‑Qaida, Ayman al-Zawahiri, as a personal friend, and he is held in the highest esteem by the rest of al-Qaida’s regional heads, from North Africa to Yemen. His numerous books and pamphlets are required reading for Islamic militants around the world, who eagerly follow the latest proclamations on Maqdisi’s website, the Pulpit of Monotheism and Jihad. But he may be best known for personally mentoring Abu Musab al-Zarqawi, who founded the organisation that would later become Isis, while the two men were jailed together on terrorism charges in Jordan in the mid-1990s. Zarqawi was released in 1999 and, after swearing allegiance to al-Qaida, went on to become one of the most notorious figures in postwar Iraq, unleashing a brutal campaign of sectarian terror, which led Maqdisi to publicly upbraid his most famous student in a series of devastating public critiques.

Now the man US terrorism analysts call “the most influential living jihadi theorist” has turned his ire toward Isis – and emerged, in the last year, as one of the group’s most powerful critics. Soon after the Isis leader Abu Bakr al-Baghdadi declared the establishment of a caliphate last June, Maqdisi released a long tract castigating Isis as ignorant and misguided, accusing them of subverting the “Islamic project” that he has long nurtured.

Maqdisi’s war of words with Isis is emblematic of the new fratricidal split within violent Islamic radicalism – but it is also a sign that al-Qaida, once the world’s most feared terrorist network, knows it has been surpassed.

Isis has not simply eclipsed al-Qaida on the battlefields of Syria and Iraq, and in the competition for funding and new recruits. According to a series of exclusive interviews with senior jihadi ideologues, Isis has successfully launched “a coup” against al-Qaida to destroy it from within. As a consequence, they now admit, al-Qaida – as an idea and an organisation – is now on the verge of collapse.

On a sunny spring afternoon, three weeks after his release from prison, Maqdisi sat on a sofa at his friend Abu Qatada’s house, fuming about Isis: the group had lied to him and betrayed him, he said, and its members were not worthy of calling themselves mujahideen. “They are like a mafia group,” Abu Qatada added, while Maqdisi nodded his assent.

Who is Abu Bakr al-Baghdadi? - video explainer Guardian

Abu Qatada – who successive British home secretaries tried to deport to Jordan on terror-related charges – has joined Maqdisi as one of the most prominent radical clerics to publicly attack Isis, and his statements of condemnation have been even more scathing. Initially, their strategy seemed to be to bring Isis back under the authority of al-Qaida, using something like a good cop, bad cop approach: Maqdisi played the role of the disappointed father, admonishing and giving guidance in equal measure, while Abu Qatada has poured increasing amounts of scorn on them.

The list of Isis’s crimes that have offended Maqdisi and Abu Qatada is long. They include creating division within the wider jihadi movement, publicly snubbing Zawahiri and establishing a caliphate to which Isis demands every other jihadi swear fealty or face death. For more than a year both say they have worked behind the scenes, negotiating with Isis – including with Baghdadi himself – to bring the group back into the al-Qaida fold, to no avail. “Isis don’t respect anyone. They are ruining the wider jihadi movement and are against the whole ummah [Muslim nation],” Abu Qatada said.

Isis are ruining the wider jihadi movement and are against the whole ummah Abu Qatada

Isis has been sufficiently worried by the increasingly vehement criticism from Maqdisi and Abu Qatada to embark on a social media campaign against them – said to have been sanctioned by Abu Muhammad al-Adnani, Isis’s chief propagandist. Isis social media accounts berate the two al-Qaida clerics as “stooges” of the west, part of a growing conspiracy against the caliphate. The sixth issue of Isis’s English-language magazine, Dabiq, featured a full-page picture of Maqdisi and Abu Qatada, labelled as “misleading scholars” who should be avoided more than the devil himself. “Qatada and I have been critical of them,” Maqdisi said. “They hate that.”

The two ideologues make an odd pair in the fight against Isis. Qatada is 6ft 3in tall, broad shouldered and lumbering, while Maqdisi is rake thin and full of hyperactive energy, bounding round the room and speaking at double speed; at serious moments, Maqdisi is given to making a sudden joke or bursting into giggles. Sometimes they will go for walks with each other in the Jordanian countryside. More often they travel long distances by road after being asked to attend funerals of fallen al-Qaida fighters.

Abu ­Muhammad al-Maqdisi, the intellectual godfather of al-Qaida. Photograph: Mustafa Khalili

Maqdisi’s notoriety has ensured that he has spent most of the past two decades in and out of jail. (He claims to have been subject to torture – which is indeed widespread in Jordanian prisons; pulling the hairs out of a radical’s beard, he said, is one favoured method of inflicting pain.) It is widely believed that the Jordanians released him again this February because they realised, with Isis rampaging across the region, that his stature made him a valuable ally in the struggle against the militant group.

But Maqdisi and Qatada have looked on as Isis’s young radicals rampage from victory to victory – cursing, mocking and betraying the old guard as they go, while al-Qaida, largely guided by veterans of the Afghan era, has been brought to its knees in this jihadi civil war.

As Qatada poured tea into small glass tumblers, he began reeling off images to better communicate the depth of his loathing for Isis. He likes speaking in metaphors. The group, he said, was “like a bad smell” that has polluted the radical Islamic environment. No, they were better described as a “cancerous growth” within the jihadi movement – or, he continued, like the diseased branch of a fig tree that needs to be pruned before it kills the entire organism.

Qatada, who was once described by the British Special Immigration Appeals Commission as a “truly dangerous individual … at the centre of terrorist activities associated with al‑Qaida”, has a strained, high-pitched voice, like an alto version of Marlon Brando in The Godfather; he speaks slowly, pausing for effect. His broad frame easily filled one of the throne-like Louis-XIV-style armchairs that line his reception room. Comfortably ensconced, he turned to yet another metaphor to describe how Isis has recruited a generation of young Muslims who barely remember the 9/11 attacks. “You go to a restaurant and they present to you this beautiful meal. It looks so delicious and tempting. But then you go into the kitchen and you see the dirt and the filth and you’re disgusted.”

Both men are particularly appalled, they said, by the way Isis has used their scholarship to cloak its savagery in ideological legitimacy, to gain recruits and justify its battle with al-Qaida and its affiliates. “Isis took all our religious works,” Maqdisi said. “They took it from us – it’s all our writings, they are all our books, our thoughts.” Now, Abu Qatada said, “they don’t respect anyone”.

Such impudent behaviour, the two men agreed, would never have been accepted in the days when Bin Laden was alive. “No one used to speak against him,” Maqdisi lamented. “Bin Laden was a star. He had special charisma.” But despite their personal affection for his successor, Zawahiri – whom they call “Dr Ayman” – they both admit that he does not possess the authority and control to rebuff the threat from Isis. From the “very beginning” of his tenure, Zawahiri lacked “direct military or operational control,” Qatada said. “He has become accustomed to operating in this decentralised way – he is isolated.”

According to Maqdisi, al-Qaida’s organisational structure has “collapsed”. Zawahiri, Maqdisi said, “operates solely based on allegiance. There is no organisational structure. There is only communication channels, and loyalty.” And unfortunately for Zawahiri, Isis has done its utmost to ensure that loyalty is in short supply.

The radical cleric Abu Qatada says Isis is a ‘cancerous growth’ within the jihadi movement. Photograph: Mustafa Khalili

Dr Munif Samara – a veteran of the jihad in Afghanistan and a close associate of Maqdisi and Qatada, who sat with both men as they were interviewed – painted an even more gloomy picture of al-Qaida’s position. A GP who runs a free clinic treating injured Syrian fighters and civilians, Samara has more experience than Maqdisi or Qatada with the day-to-day operations of jihadi organising, and has often handled the affairs of the two men during their frequent jail stints. He said that donations, which once came in waves of “hundreds of thousands”, have dried up as donors directed their money to Isis, or else refused to fund further bloodletting between the two groups. Another former al-Qaida member, Aimen Dean – who defected to become a spy for British intelligence – told the Guardian that one of his sources in Pakistan’s tribal areas said the finances of al-Qaida central in Waziristan were so desperate that it was reduced at one point last year to selling its laptops and cars to buy food and pay rent.

Samara described Isis’s fight against al-Qaida as an attempt to bring the older group down from within. “At this moment, we do believe there is a coup d’etat under way within al-Qaida itself,” he said.

In the decade after 9/11, al-Qaida attracted money, initiates and prestige like no other jihadi group in history. It grew to command the loyalty of a wide network of terrorist branches and affiliates that stretched from Europe to Africa and South Asia. Never before had so many geographically disparate groups been united under one banner. Bin Laden achieved this feat, at least in part, by remaining ideologically flexible. He refused to be proscriptive on small matters of faith, avoiding the kind of disputes that had ripped apart other jihadi coalitions in the past. In keeping with its formal name – Tandheem Qaidat al-Jihad, The Organisation for the Base of Jihad – al-Qaida acted as a hub for militants to make connections and receive financial and organisational support. Regional commanders were entrusted with a great deal of operational freedom.

The finances of al-Qaida were so desperate that it was reduced to selling its laptops and cars to buy food and pay rent

In return, al-Qaida’s leadership demanded one thing above all else: loyalty. Its commanders were strictly vetted before being appointed; only those known from the battlefields of Afghanistan, Bosnia or Chechnya – and deemed to have the requisite knowledge of Islamic scholarship – were elevated to the group’s upper echelons. On their appointment, these senior commanders swore a blood oath to Bin Laden himself.

When Zawahiri took over after Bin Laden’s death in 2011, he found himself geographically isolated. While he was hiding out, according to numerous sources, in the mountains on the Afghanistan-Pakistan border, the centre of jihadi activity had moved thousands of miles away, to Syria and Iraq. As Pakistan’s army and American drones tightened their net around al-Qaida central, it became harder and harder for Zawahiri to maintain contact with his commanders in the field. “What is leadership,” Samara asked, “if your leader is in Afghanistan and your soldiers are in Iraq?”

In fact, al-Qaida’s main branch in the Middle East, the Islamic State of Iraq (ISI), had long been a source of difficulty. Since its effective creation in 2003, under the leadership of Abu Musab al-Zarqawi, ISI had been happy to use al-Qaida’s brand name and its money, but often ignored pleas for closer communication with central command – even when they came from Bin Laden himself. In 2010, they crossed a line: ISI appointed a new leader, Abu Bakr al-Baghdadi, without prior approval from al-Qaida, whose senior leaders knew almost nothing about the man – where he had come from, his military experience, whether he could be trusted.

In a revealing communique seized during the raid on Bin Laden’s hideaway in Abbottabad, Adam Gadahn – the American al-Qaida member and frequent spokesman – voiced his disgust with ISI’s lack of respect. Writing to Bin Laden in January 2011, he asked why ISI should be permitted to sully al-Qaida’s name with its indiscriminate slaughter when it could not even bother to keep in touch with the group’s leadership. “Maybe,” he wrote, “it is better for them not to be in the ranks of the mujahideen, as they are just like a polluted spot that should be removed and sanitised and cleared from the ranks.” Less than six months after receiving the letter, Bin Laden was dead. Now it fell to Zawahiri, a man of lesser standing, to deal with the problem.

By this time, ISI had been pushed to the brink of collapse by US and Iraqi forces – but the Syrian civil war gave the group a chance to rebuild. As the conflict began to intensify, Baghdadi quietly dispatched one of his junior officers, Abu Muhammad al-Joulani, across the border in late 2011 to take advantage of the chaos. Equipped with funds, weapons, and some of ISI’s best soldiers, Joulani’s group – which would soon be known as the Nusra Front – quickly became the most formidable fighting force in Syria. By 2013, Joulani was such a powerful commander in his own right that Baghdadi feared he was on the verge of obtaining Zawahiri’s support to elevate himself as the leader of an independent al-Qaida branch in Syria.

Ayman al-Zawahiri, the leader of al-Qaida, has struggled to assert his authority from his hideout in Waziristan. Photograph: AFP/Getty Images

On 8 April 2013, Baghdadi launched a pre-emptive strike – whose consequences would rip apart the banner of unity that had long presided over the jihadi movement. In an audio recording released online, Baghdadi declared that the Nusra Front and ISI would officially become one organisation. Nusra’s battle-stained banners, which hung over their newly captured headquarters in Syrian cities such as Raqqa, Aleppo and Homs would be replaced. The merged organisation would be called the Islamic State in Iraq and Syria, or more simply Isis. The rebrand was effective immediately. Two days later, Joulani replied with his own audio message. He rejected Baghdadi’s “invitation” to merge – and pledged an oath of loyalty directly to Zawahiri, appealing to the “sheikh of jihad” to resolve the dispute.

Within 24 hours, Zawahiri dispatched a private message urging calm. He said he wanted both commanders to send him representations before he would rule on this spat, which had, thanks to the internet, become embarrassingly public. Baghdadi made it clear that he was not willing to compromise: in a personal message, he warned Zawahiri that any hint of support for the “traitor” would have “no cure except the spilling of more blood”.

On 23 May, Zawahiri delivered his verdict: Isis, which had been created without prior approval, would have to be “dissolved”; Baghdadi was ordered to restrict his operations to Iraq. Meanwhile, his former junior, Joulani, would become the leader of al-Qaida’s official branch in Syria. Both men, Zawahiri added, had a year to prove themselves, after which al-Qaida central would decide on what measures to take next. Like any suspended sentence, it was both an offer of redemption and a threat: Baghdadi could prosper by playing nicely within the new rules, or lose his position within al-Qaida entirely. Finally, to ensure his accord was adhered to peacefully, Zawahiri dispatched an emissary, Abu Khalid al-Suri, in whom he vested the power to resolve any further disputes.

One former senior member of ISI who did not want to be named told the Guardian that Baghdadi was incensed by Zawahiri’s letter: he was shocked to be treated as an equal to Joulani and ordered to stay out of the Syrian conflict into which he had invested so much. According to Maqdisi, Baghdadi contemptuously dismissed Zawahiri’s envoy. “Suri told Baghdadi, if you stick to these points and you go back to Iraq, I will not make this order public,” Maqdisi said. “Instead, Isis refused the orders, and then started attacking Zawahiri – saying, ‘Al-Qaida is gone, it’s burned out.’”

After Suri made good on the threat to go public with Zawahiri’s humiliating diktat – which was released to al-Jazeera in June – Baghdadi issued his own blunt and unbending reply: “As long as we have a pulse or an eye that blinks,” he said, Isis was there to stay. It was the first time a major al-Qaida figure had ever publicly defied the organisation’s leader. “That was an alarm bell,” Abu Qatada recalled.

That summer, Isis began preparing for war: swelling its ranks and readying itself to claim back Syrian territory from Nusra, which it believed was rightly its own. In an astonishing series of prison breaks, it freed hundreds of Iraq’s most dangerous inmates by firing mortar rounds at walls and using car bombs to blow apart entrances. According to secret documents recently obtained by Der Spiegel, Isis also began implementing plans to take advantage of the stream of thousands of men who were flooding into Syria from Tunisia, Saudi Arabia, Turkey, Egypt and Europe. Without ties to native Syrians, these foreign fighters were likely to remain loyal. And they needed to be loyal, because instead of fighting Assad – as they had come to Syria to do – they would be used to stab the homegrown anti-Assad rebel groups in the back.

One of Maqdisi’s close associates in Jordan is a man who we will call Raheem, a personal aide to Abu Musab al-Zarqawi who helped found the organisation that evolved into Isis – and who had an inside view of the group’s transformation after Baghdadi took power. A hulking figure, standing at more than 6ft 4in, he appeared suddenly one day at Maqdisi’s house, after hearing a rumour that Isis followers had assaulted his sheikh. In an interview a few weeks later, Raheem described the men running Isis as a different breed from the religiously inspired jihadis of al-Qaida; in fact, he said, the group had been run for several years by men who once served Saddam Hussein’s Ba’athist regime.

Where does Isis get its money? - video explainer Guardian

According to Raheem, when Zarqawi was in charge, it was his unofficial policy to shut out anyone from the secular nationalist Ba’ath party. Zarqawi firmly believed that Iraqis in general, and Ba’athists in particular, lacked piety. Under Hussein, Iraq had been a secular state, and Islamism – the body of intellectual work that has turned Islam from a religion into a full-blown system of governance – had been brutally suppressed. “There were very few Iraqis who were exposed to other ideas,” Raheem said. “They were nationalists and were highly influenced by the Ba’ath.”

After Zarqawi’s death in 2006, ISI was almost destroyed by US forces and Sunni tribes revolting against its brutal violence. To save themselves, Raheem said, ISI’s inner circle decided that the group needed to broaden its ranks: revolutionary Islamist credentials were no longer essential – if you could recite a few lines of the Qur’an and grow a beard, you could sign up. The former Ba’athists, who had run Iraq for decades, were invaluable new recruits: Hussein’s former military officers knew the vulnerabilities of the Iraqi army; his former intelligence officials knew the power brokers in each town and village. Since the regime’s overthrow, these men had lost their incomes and their authority; now the Islamic State of Iraq would serve as a vehicle for them to regain their status. (Documents obtained by Der Spiegel have revealed the major role played by a former colonel in Hussein’s air intelligence service, known as Haji Bakr, who is said to have been the architect of Isis’s takeover of northern Syria; according to Raheem, he brought an entire Ba’athist unit with him when he joined the group.)

Raheem alleged that it was largely these men – former Ba’athists who became senior members of ISI – who nominated Baghdadi as the organisation’s new leader in 2010. Until his appointment, Raheem said, Baghdadi was regarded as a minor figure, quiet and uncharismatic. He had no military experience, and his scholarship was of little note, though he held a PhD in Islamic studies. But he made the ideal front man: on paper, at least, he was a religious scholar; his family claimed to be descended from the prophet Muhammad; and most importantly of all, he was not himself a Ba’athist.

After Baghdadi’s appointment, ISI’s inner circle closed ranks around its chosen leader. It discontinued all but the most cursory communication with al-Qaida central, and slowly, the few remaining senior figures considered loyal to Zawahiri were either deliberately sidelined or killed off on the battlefield. By the time Zawahiri’s fateful letter arrived in May 2013, Raheem said, there was not a single person in Isis’s senior leadership who had once belonged to al-Qaida.

Later that year, while the rest of the world was fixated on Assad’s chemical weapons, Isis planned to seize control of the 500-mile border between Turkey and Syria: if it could hold the border crossings, which supplied the main rebel groups with food, medicine, weapons and new recruits, Isis would have Nusra and its other rivals by the throat. By December, strategically important border towns began to fall, one by one, to Isis fighters. Isis fighters rode into towns whose freedom from Assad had been won at great cost, stripped factories bare, and turfed out – or killed – other fighters and their families. They kidnapped high-level commanders from other rebel groups, and murdered Syrian civilians who had been involved in the earliest mass protests against Assad, calculating that these were the only people brave enough to confront Isis in the future.

In December 2013, Hussein Suleiman, a handsome young physician who was also a senior officer of the Islamic Front rebel group, was sent to make peace with a local Isis unit after trouble broke out at a checkpoint near Lake Assad in eastern Syria. When Suleiman did not return to base, Islamic Front officials contacted Isis, which confirmed they were holding him prisoner as a spy. Outraged, the Islamic Front demanded his release. Surely Isis could not go around arresting peace brokers? At the very least, they asked that his crimes be tried in an independent sharia court. Isis refused.

When Isis released Suleiman as part of a prisoner exchange on 31 December, the Islamic Front received a mutilated corpse: his right ear had been cut off, his teeth were knocked out, one of his legs had been broken. The young doctor had been tortured, and the top of his head was blown off. The next day, the Islamic Front posted pictures of his mangled body online, next to those of how he used to look. They spread rapidly on social media and sparked protests in towns across Syria against Isis brutality. In Isis-controlled towns, fighters shot at the protesters, fuelling more outrage.

Within days, Syria’s major rebel groups – including Nusra, the country’s al-Qaida affiliate – banded together to declare war on Isis. Thousands of militants were killed over the first few months of 2014, as battles raged between Isis and the other rebel factions, with senior commanders on both sides kidnapped, tortured and murdered. As their positions were overrun, Isis was forced to retreat from western Syria. It began consolidating its control over the east, the area closest to Iraq, and the location of many of Syria’s oil fields. There, Nusra and Isis fought viciously, in and around the city of Raqqa and along the banks of the Euphrates.

On 16 January 2014, Zawahiri’s envoy, Abu Khalid al-Suri, published a message online. He tweeted that Isis was seeking to corrupt the jihad as it had done in Iraq: militants should direct their bombs at the infidels, he declared, not at their fellow jihadis. Seventeen days later, Zawahiri played his final card: Isis was expelled from al-Qaida.

For Isis, there was no turning back. To make clear that reconciliation was off the table, they sent their former boss a message that he would not forget. On 21 February, five men fought their way into the compound in Aleppo where Suri was staying. When their target appeared, one of the attackers detonated his suicide vest. Zawahiri’s loyal servant, who had been sent from Afghanistan to make peace, now lay dead.

From their jail cells in Jordan, Abu Qatada and Maqdisi watched the vicious struggle between Isis and al-Qaida with growing concern. For Abu Qatada, it felt like history was repeating itself. In the early 1990s, he had been a fervent supporter of the Algerian Groupe Islamique Armé (GIA) – issuing fatwas that gave GIA terrorists license to kill with little discrimination. But when the GIA inevitably began murdering rival militants, Abu Qatada assembled a group of radical scholars to denounce the organisation, helping to strip it of intellectual credibility among fellow jihadis. Now, more than 20 years later, he wanted Maqdisi to join him in a similar campaign against Isis – to publicly shame the group as extremists acting outside the accepted rules of jihad.

Maqdisi asked Abu Qatada to hold off. He still hoped that Isis could be brought back within the fold. Some of Isis’s most senior members had already written to him in prison signalling their contrition. One letter said: “We know that we have made mistakes … We know that among our soldiers and clerics there are some who are extremists … But they are the minority.” (It was signed: “Your son, one of the sharia legislators for the Islamic State of Iraq and Syria written by request and on behalf of some of his brothers.”) With the right plan for reconciliation, Maqdisi believed that unity might be restored.

Using intermediaries to keep Zawahiri informed of his attempts at arbitration, Maqdisi reached out to Isis’s inner circle in late 2013, approaching one of his former students, a young Bahraini named Turki Binali. Binali had been his protege – a pupil of “extraordinary passion”, in Maqdisi’s words. Some nicknamed him “Maqdisi junior”. After joining Isis, Binali rapidly rose into its highest ranks: he was appointed as Baghdadi’s official biographer, and by spring 2014, he had been named Isis’s chief “scholar at arms”. In theory, a single decree from Binali’s pen could end the civil war between Isis and al-Qaida.

Maqdisi, who dispatched two of his own students to meet Binali in person, said that their initial exchanges were encouraging: he warned Binali that unless Isis was willing to negotiate an end to the conflict with al-Qaida, the group risked condemnation from the world’s most eminent jihadi sheikhs. In response, Binali assured his “beloved teacher” that Baghdadi wanted nothing more than to reach agreement with al-Qaida. But as months passed, and the fighting continued, Maqdisi came to believe Binali had little intention of settling the feud.

How, Binali asked Maqdisi, could Zawahiri have praised the Arab Spring when the people who had risen up in Egypt and elsewhere were calling for democracy, not sharia? Why, he asked, did Zawahiri refer respectfully to the US president as “Mr Obama”? Perhaps, Binali intimated, al-Qaida had decided to quit the jihad and settle into a quieter existence as a peaceful organisation? Maqdisi thought these questions were “absurd”, he said – “meaningless, insignificant points”, which Isis had “never mentioned in the past”.

By spring 2014, communications between student and teacher had seriously deteriorated; at one point, Binali slighted Maqdisi by suggesting that old age had confused him. After drafting a short online article entitled “My former Sheikh”, Binali stopped replying altogether. On 26 May 2014, Maqdisi deemed the negotiations dead and, backed by his fellow al-Qaida ideologues, issued a fatwa against Isis.

“It has become necessary that we tell the truth, after we exhausted all the possibilities of advice and all hopes of making Isis return to the path of truth,” Maqdisi wrote. The rebellious organisation, he declared, had no “Islamic pretext”. Baghdadi, his commanders, and their religious officials were “deviants” who had “disobeyed the orders of their leaders and head scholars”. He instructed Isis’s soldiers to defect to the Nusra Front, and decreed that no Islamic website should host Isis messages.

This was a serious threat to Isis’s legitimacy, and even its future. According to a series of detailed leaks from an anonymous Twitter account – much of which the Guardian has subsequently verified – Binali approached Baghdadi with a stark appraisal of Isis’s vulnerable position. The caliphate would eventually collapse, he said, if the jihad’s leading scholars and veterans continued to stand against Isis. The project could not be sustained unless Isis recruited influential supporters.

Binali’s solution to this problem was simple: if Isis could not win support, it would buy it. In the summer and autumn of 2014, messages were sent to Maqdisi, Abu Qatada and about a dozen other top-ranking clerics, inviting them to relocate to the caliphate, where they could work without fear of imprisonment. (Baghdadi even wrote a personal letter to Maqdisi to persuade him to come). To sweeten the deal, payments of up to $1m were promised. Binali also sent word to al-Qaida’s branch in Yemen that Isis would offer its leader and his men $10m to publicly pledge allegiance to Baghdadi; a similar offer, for $5m, was made to the al-Qaida affiliate in Libya.

Binali’s scheme had mixed results. Maqdisi, Qatada and the other prominent scholars rejected the offer out of hand, as did Yemen’s al-Qaida commander. But Binali appeared to have captured the interest of several jihadi factions across the globe. In November, Isis trumpeted public oaths of loyalty from jihadi militants in Egypt, Libya, Pakistan and even Yemen, al-Qaida’s strongest redoubt. Suddenly, the group’s influence was extending beyond Syria and Iraq, into the rest of the Islamic world.

Dr Munif Samara, the jihadi doctor and close associate of Maqdisi and Abu Qatada. Photograph: Mustafa Khalili

There would be other exchanges between Maqdisi and Binali later that year, including a failed attempt to secure the release of the Isis hostage Peter Kassig. Their final communication came not long after Kassig’s execution, when Maqdisi once again found himself mediating with Isis. On 24 December 2014, a Jordanian military aircraft was shot down over Isis territory near the northern Syrian city of Raqqa, and its pilot taken hostage; Maqdisi heard the news when the prison imam dedicated a prayer to the man. Soon after, Maqdisi sounded out Jordanian officials about an idea, originally suggested by his friend Dr Munif Samara, to secure the return of the pilot. Although Jordanian officials were wary, believing that the pilot could have been killed already, they authorised the plan.

Communicating primarily via Telegram messenger, an app that allows for encrypted communications, Maqdisi sent word to Isis in January of this year that the Jordanians would be willing to conduct a prisoner swap: in return for the pilot, they would release a woman named Sajida al-Rishawi. In 2005, Abu Musab al-Zarqawi had sent al-Rishawi and her husband on a mission to Jordan, where they were to explode bomb belts at the Radisson SAS hotel as part of a coordinated series of suicide bombings. Rishawi’s device did not detonate, and she was arrested, languishing on death row for the next decade. In his approach to Isis, Maqdisi said, he reminded the group’s senior leaders that, as the inheritors of Abu Musab al-Zarqawi’s legacy, they had an obligation to save her now.

Although Maqdisi is not certain about who he was communicating with, he has no doubt that his messages were being relayed to the most senior members of Isis, including Baghdadi himself. The initial response was positive: Maqdisi says he was told that Isis were “eager” to make the trade. On social media, Isis supporters suddenly began calling for al-Rishawi’s release.

Before any deal could be brokered, the Jordanians instructed Maqdisi to obtain proof that the pilot was still alive. In response, the Isis negotiators sent Maqdisi an electronic file that they claimed would provide proof of life – but the file was password protected.

On 3 February, after a few days of tense dialogue, the negotiators finally sent Maqdisi the password to unlock the file. When he received it, Maqdisi realised he had been betrayed: the password, in Arabic, was “Maqdisi the pimp, the sole of the tyrant’s shoe, son of the English whore.”

After he typed it in, one humiliating character at a time, a video appeared on Maqdisi’s screen. He watched in horror as Isis soldiers muscled the pilot into a cage, doused him in petrol, and burned him alive. Three hours later, Isis posted the video on the internet. The next day, Sajida al-Rishawi was taken from her cell and executed.

At his house on the outskirts of Zarqa, about 25km from Amman, Maqdisi keeps a large model boat on top of one of his overstuffed bookshelves. It’s a strange object to find there: Islamic extremists are not known for their maritime collectibles. The boat was a gift from a very senior member of Isis, who built it from pencils and matchsticks while incarcerated in Abu Ghraib. Above the boat’s sails hangs a banner that reads “Journey with us,” a quotation from the Quranic retelling of the story of the flood, when Noah reaches out to beckon his son aboard. For Maqdisi, it is a symbol of salvation and unity. “It’s meant as a message for all Muslims,” he said – one with a special significance for jihadis today, as the factional bloodshed rages on.

Abu ­Muhammad al-Maqdisi’s model boat was made for him by a very senior member of Isis, who built it from pencils and matchsticks while incarcerated in Abu Ghraib. Photograph: Mustafa Khalili

Maqdisi and Abu Qatada continue to hope that the unity that once prevailed under bin Laden will return – but they admitted openly that Isis is winning the war on the ground and the propaganda struggle alike. “It’s a fluid state of affairs,” Abu Qatada suggested hopefully. “At the moment, Isis are drunk on power.” But at some point, he believes, they will need to negotiate with al-Qaida again. He pointed out that al-Qaida’s branch in Syria had achieved some recent successes against Assad’s forces, while Maqdisi observed that there were several other branches, including the one in Yemen, whose allegiance remains unquestioned. “Its loyalty is strong and clear,” Maqdisi said. “When Zawahiri sends a message to Yemen, he knows his orders will be obeyed.”

But the two men believe that the events of the past decade – and especially the war with Isis – are a sign that al-Qaida needs to reappraise its tactics. Maqdisi believes that al-Qaida should no longer aim to recruit followers in large numbers; it needs “people of quality”, he said, who thoroughly understand Islamic scholarship, and will not merely deploy it in the furtherance of their own personal ends.

In recent years, Maqdisi has even come to believe that al-Qaida’s conception of jihad – one licensed in part by his own scholarship – may have been incorrect, a jihad of “spite” rather than “empowering believers”. Even the attacks of 9/11, Maqdisi said, were part of a misguided strategy. “The actions in New York and Washington, no matter how great they appeared to be – the bottom line is they were spiteful.”

Maqdisi now wants al-Qaida to begin providing social services, as Hamas has done in Gaza. “That kind of enabling jihad will establish our Islamic state. It will enable it to become a place of refuge for the weak,” he said. Al-Qaida branches in Tunisia and elsewhere have been putting this suggestion into practice – with jihadis guarding hospitals, building infrastructure, and even picking up litter. And yet, as one al-Qaida veteran who did not want to be named told the Guardian, local commanders have reported that their soldiers are impatient with these new duties; many would prefer for Zawahiri to swear allegiance to Baghdadi.

Munif Samara, the jihadi doctor and close associate of Maqdisi and Abu Qatada, worried that al-Qaida may be crippled by its difficulty attracting new recruits. Young soldiers, he said, “want action, they want blood, they want explosions. They are sitting in their countries, and either they will be in jail or something like this, and they are waiting for al-Qaida [to do something], and al-Qaida is doing nothing.” For these young men, the lure of Isis is strong.

Al-Qaida has long maintained that while the establishment of the caliphate is the ultimate goal, conditions are not yet right: ordinary Muslims need to be educated about “true Islam” for many more years before it can return. But it has now been a year since Baghdadi declared his own caliphate – and the longer that Isis can hold its territory and broadcast its military successes to the world, the more credibility it will steal from al-Qaida.

As ideologues steeped in almost 1,400 years of Islamic scholarship, Maqdisi and Abu Qatada tend to the long view – for them, the proper perspective on al-Qaida’s present crisis is one of decades rather than months, which may explain their relative optimism about its possibility for renewal. For now, however, their fierce attacks on Isis have done little to halt its advances. Given the group’s ruthlessness and disdain for criticism, it is hard not to imagine, as one walks away from Maqdisi’s house, that if the war continues, it may not be long before he and Abu Qatada find themselves in the crosshairs.

• Follow the Long Read on Twitter: @gdnlongread