Shortly after midnight last Sunday, Sohaib Athar, an IT entrepreneur in the small northern Pakistani town of Abbottabad, heard helicopters as he worked on his computer.

A "helicopter/UFO" had been shot down a few streets away, he tweeted, and there were "reports of a flash". Still on Twitter, he mulled the possibilities. It might be the Taliban, but it had no air force. Maybe a CIA drone, though they usually struck 200 miles away in Waziristan, not in garrison towns a mere 30 miles north of Islamabad, the capital. "Must be complicated," he tweeted.

Hours later, as dawn broke over Abbottabad, bewildered Pakistani intelligence agents stumbled through the wreckage of a three-storey house, finding bloodied corpses, at least three women bound with plastic handcuffs and a huddle of scared children. At first the women, who spoke only Arabic and were hysterical with grief, struggled to communicate with the Pakistani spies and soldiers. Then one blurted it out: she was the wife of Osama bin Laden and had been living in Pakistan for six years. And, yes, her husband had been killed.

As Athar, 34, had been tweeting and Abbottabad had been shaken by the sound of explosions, Barack Obama and his top national security staff sat in the Situation Room, a huge conference centre beneath the West Wing of the White House, monitoring events on the other side of the planet.

The 79 elite US special forces Seals (for Sea, Air, Land) who landed at the Abbottabad house were from Team Six, the elite of the elite. Arduous selection – which 90% of recruits fail – plus years of training and many combat missions over the long years of the "war on terror" in Afghanistan, in Iraq and elsewhere, had prepared them for the operation. In the weeks before the raid, they had practised assaults on a replica of the house.

Flying from a base in eastern Afghanistan in four helicopters equipped with new stealth and jamming technology, no one spotted them. Resistance was light as they moved into the building. The only return fire came from outside the house and was quickly silenced. The Americans moved rapidly through the building. A younger man – Bin Laden's 28-year-old son, Khaled – appeared on the third-floor landing. He was shot dead. The Seals then moved towards a bedroom. Inside was a wounded 12-year-old girl, a woman who moved forward abruptly and was shot in the leg, and a tall, unarmed man who backed away. He was shot twice, one round to the larger target, the chest, and one to the head. "Geronimo – EKIA," those in the Sit Room heard the commander of the raid say. Geronimo – Bin Laden's decidedly un-PC mission codename – Enemy Killed In Action.

In Abbottabad, the Seals destroyed a damaged helicopter and scooped up all the computers and documents they could find. According to the Washington Post, a tall Seal lay down next to Bin Laden's corpse. The corpse was taller. When this was relayed to Obama, he turned to his advisers and said: "We donated a $60m helicopter to this operation. Could we not afford to buy a tape measure?"

With Pakistani security forces arriving on the scene, Admiral Mike Mullen, chairman of the joint chiefs of staff, phoned Pakistani army chief General Ashfaq Kayani to tell him about the raid. Kayani reportedly congratulated his counterpart but, immediately sensitive to the implications, asked him to ensure Obama did not say anything negative about Pakistan in his address to the nation hours later. The CIA chief, Leon Panetta, phoned his counterpart at Pakistan's Inter-Services Intelligence (ISI), General Shuja Pasha.

For 10 years the CIA and a range of other agencies had been trying to get a substantial lead on Bin Laden. They knew he had been at Tora Bora, the mountains south of Jalalabad in eastern Afghanistan in December 2001, but then the trail went cold. However, the CIA had one crucial lead – the couriers used by al-Qaida to avoid US eavesdropping technology.

One courier interested the agency. It took some time to get a name – Abu Ahmed al-Kuwaiti, a nom de guerre – but the fact that Khaled Sheik Mohammed, one of the organisers of the 9/11 attacks, and other leaders in detention said they had never heard of him seemed to confirm to the CIA they might be on to something. The interrogations of other militants filled out the picture further.

The first breakthrough came in 2007. US surveillance teams got hold of a phone number used by the courier. According to Pakistani officials, it was given to them by the ISI, after a series of odd calls to the Middle East and elsewhere aroused suspicious locations. The next stage again took some time. Though the CIA was able to learn more about al-Kuwaiti – whose real name was Arshad Khan, a Pakistani who had grown up in the Gulf – they were unable to find him. Finally, last year, his car was spotted by Pakistanis working for the CIA in Peshawar, near the Afghan frontier. Khan was found and followed to Abbottabad where the trackers discovered the three-storey compound with its high walls, small windows and barbed wire. A safe house was established and the house watched.

A tall man was regularly seen in the garden, walking up and down. Dubbed "the pacer", it was unclear if it was Bin Laden. But the composition of the family living with him matched what was known of the Saudi-born fugitive. When the watchers felt they had got all they could, it was time for Obama to make a decision. At best the identification was only 60-80% certain, but it was by far the best yet. To bomb the compound risked killing civilians – even Pakistani soldiers – and vaporising any humans on site.

The decision was made to send in the special forces instead. Last Saturday night, Obama addressed journalists at a gala evening. The following morning he played golf and then, after one round rather than his usual two, he headed back to the White House.

News that something big had happened first went out just after 9.45 last Sunday night in a terse message to the White House press corps, announcing an address to the nation 45 minutes later. No topic was given. By 10.25 pm, as Obama was still putting the finishing touches to his speech, the news leaked, again on Twitter.

Keith Urbahn, a top aide to former defence secretary Donald, received a call from a TV news producer asking for Rumsfeld's reaction to Bin Laden's death. Urbahn deflected the call but tweeted: "So I'm told by a reputable person they have killed Osama bin Laden. Hot damn." With users thinking Urbahn had his information from Rumsfeld, the tweet went viral. Even before Obama announced the facts, the cable news shows began reporting the story.

Across America celebrations broke out. People reacted in mixed ways. Seeing the news on the TV in one trendy bar in Manhattan's East Village one older man let out a yell and burst into tears. His friends explained to the barman that he had lost several friends in the terror attacks of 9/11. But the reactions of some others, especially the young, were more straightforward. They cheered and chanted. "They're about 23. They were so young when it happened 10 years ago, what do they really know about it?" the barman, Jack Barley, said.

At Ground Zero in New York, in front of the White House in Washington and in many others public places across the US, including a baseball game in Queens, New York, people started to sing and shout. Outside the White House, which lies not far from several bustling bar districts popular with students, drunken revellers waved flags. In the streets around where the Twin Towers had once stood – now a enormous building site – people gathered, some to celebrate, some to mourn. Flowers were pressed into the security railings. One cardboard placard read: "The end of an era."

If news of the raid prompted celebrations in the US, in Pakistan reaction oscillated between stunned disbelief, embarrassment, anger and outright denial. Small protests led by religious parties erupted in several cities. But most Pakistanis searched for answers; those they found were not comforting.

Many Pakistanis consider their military the bedrock of the fragile state. Now it came under unprecedented criticism. With the military receiving a large chunk of Pakistan's budget, many Pakistanis wondered how could the army not prevent such an operation by a foreign power and the ISI, the famously powerful military spy agency, not spot a CIA team, sitting in a safe house?

"The CIA scooped the ISI, left them holding the bathwater, and took the baby away," said analyst Najam Sethi.

On Friday, Pasha, the ISI chief, flew to Washington, where other pressing questions face Pakistan's spies. The most obvious is: what was the ISI doing while Bin Laden was holed up only a stone's throw from the country's most prestigious military academy? Many in the US refuse to believe army chief Kayani's claim, made to a group of local journalists, that Pakistan had "no clear, actionable information on Osama bin Laden".

Relations between the ISI and CIA had already reached a new low in recent months following the furore over Raymond Davis, a CIA spy who shot two people in Lahore in January and briefly stood trial before being returned to America. Now a chorus of anti-ISI critics are wondering whether the ISI knew where bin Laden was hiding.

The evidence to back the charge is circumstantial but, to some, convincing. Bin Laden's house was in a military cantonment close to a major academy and the headquarters of several army regiments. Local residents told the Observer the army carried out security patrols on the main residential thoroughfares near the bases; intelligence men filtered through the neighbourhoods, watching for potential threats. One retired colonel said no one could walk a dog without being expected to produce an ID card. But cock-up rather than conspiracy seems the likeliest explanation in the absence of any smoking gun. Certainly, that is what the ISI is saying. "It was our failure," a senior official admitted.

But the position is a delicate one. Local columnist Cyril Almeida said: "If we didn't know, we're a failed state. If we did know, we're a rogue state."

Western diplomats in Islamabad suggest a third, more prosaic possibility: lack of interest. For the past four years the army and its intelligence services have been fighting a virtual civil war against the Taliban, both in the tribal belt and the big cities. Al-Qaida was seen as posing a secondary threat and was largely the concern of the Americans. Also, as one official put it, the Pakistan army had little motivation in devoting resources to the hunt for Bin Laden. Why kill the golden goose whose presence brings in almost $3bn in annual aid and whose departure could trigger a premature US withdrawal from the region?

By the middle of the week, the recriminations in the US had started too. Despite having shown remarkably clear heads, steely nerves and iron resolve all through the tense months, weeks and days leading up to the raid, the Obama administration fumbled the handling of the aftermath. Having observed strict secrecy for years over details of the hunt for Bin Laden, White House and Pentagon officials then rushed to blurt out unsubstantiated details both in public press conferences and in private briefings. The description of the raid changed and shifted almost by the day. "They were inept at this," said Larry Johnson, a former CIA analyst and ex-senior anti-terrorism official in the State Department.

At first, the raid was described as a 40-minute fire-fight, which it had not been. Then, Bin Laden was supposed to have fired at troops from while using his wife as a human shield – which, being unarmed, he could not have done. The home in which he had spent years was first described as a million-dollar villa but it turned out to be worth perhaps $250,000, with cheap rugs, shabby blankets, no air-conditioning and old televisions. Then there was a painful and agonising to-and-fro over the release of photographs of Bin Laden's corpse. Initially the administration seemed poised to release a single picture to appease Republicans' demands and to counter conspiracy theories that the terror chief was still alive. But concerns about triggering a backlash among segments of the Muslim world who would see the picture as an unnecessary insult were stronger. "That's not who we are. We don't trot out this stuff as trophies," Obama said.

There was also the vicious row sparked by the possibility that torture had provided the crucial leads in the hunt for the al-Qaida leader.

This reopened wounds from the Bush era, with many conservatives claiming the use of "enhanced interrogation techniques" on figures such as Sheikh Mohammed had been vindicated. Opponents of torture said the chronology did not fit and quoted reports that it was the absence of a response from Mohammed and others when they heard the name of the crucial courier that had been key. One official at another western security service pointed out that it was the development of leads that was key.

"All the main elements of this investigation appear to have been classic: the use of the best contemporary surveillance technology, careful and persistent analysis, and work on the ground involving real people," he told the Observer.

That this most prized of scalps is a political trophy is beyond a doubt. It has been a rule of American politics since at least the early 1980s that Democrats are usually seen by the public as much weaker than Republicans on national security. Yet, as the 2012 election looms, the Obama team can now play up the single biggest triumph of the "war on terror" and an achievement that eluded George W Bush.

"It is a win for Obama. Republicans have no incentive to make an issue of this," said Professor Chris Gelpi, a political scientist at Duke University as a slew of polls last week showed a healthy increase in Obama's popularity. This boosts Obama's already promising re-election chances. Despite criticism from the Democrats' liberal wing and fierce dislike among conservatives, Obama faces few big-name challengers so far. The chances of a rebellion in his own party seem remote and the Republican field is divided. But there is no room for complacency for the Obama team – there is still a long way to go.

Then there is the question: what does the death of Bin Laden mean for al-Qaida, for the phenomenon of contemporary Sunni Islamic militancy more generally and for world security? Are we safer?

On Friday, al-Qaida issued a statement on the internet which pledged that Bin Laden's blood would not be "wasted", that his "university of Koran… and jihad" would not be closed and the organisation would continue the fight against the US and its allies. Signed by al-Qaida's "general leadership", it also predicted that Bin Laden's death would be a "curse" for the US. This weekend security services around the world are on high alert, fearing attacks aiming not so much at vengeance but simply at showing that the group still has capabilities.

The fact that a statement – apparently agreed by a number of different people – was put together and released successfully indicates that, at least for the moment, the few score militants who comprise the "al-Qaida hardcore" still have some cohesion.

But where does the death of their leader leave al-Qaida in the longer term? Bin Laden was more than just the public face of the group: he was the charismatic unifying presence that held together a disparate bunch of misfits and malcontents. He had formed the group in 1988 – with a dozen or so others – to overcome infighting between different militant groups engaged on the margins of the war against the Soviet army in Afghanistan. There has been evidence of tensions between Libyan, Algerian, Egyptian and Saudi factions within the leadership core of al-Qaida. Now it is likely to fragment permanently.

Certainly there are few obvious successors. Ayman al-Zawahiri, the 59-year-old former physician who was Bin Laden's closest associate still at large, is too irascible, stubborn and disliked to command much loyalty. He also lacks Bin Laden's looks and talent for communication. At the same time, younger figures lack profile and experience.

Outside the hardcore group of leaders, most of whom are in western Pakistan, there is the "network of networks", or the affiliate groups. Many of these owed little more than nominal loyalty to Bin Laden. Al-Qaida in Iraq, now restricted to the north-west corner of the country, had long since gone its own way. Al-Qaida in the Maghreb, largely based in Algeria, was similarly independent. Though paying lip service to the international agenda of globalised jihad, these groups follow an almost entirely local agenda. Elsewhere in the Islamic world, militant Islamic networks have been reduced to a negligible presence. Only al-Qaida in the Arabian Peninsula, mainly based in Bin Laden's ancestral homeland of Yemen rather than his birthplace, Saudi Arabia, has been linked to attacks in the west. There Anwar al-Awlaki, a New Mexico-born, Yemen-raised, English-speaking firebrand preacher has built up a major internet following and has been linked to a series of plots in America and elsewhere.

If the hardcore is likely to fragment and the affiliates are unlikely to be badly hit by Bin Laden's death – in part because they are already so weak – then attention will turn to the third major component of the al-Qaida phenomenon: the ideology and the social movement it has created.

In the Middle East, polls show how the popularity of al-Qaida and its methods have been dropping fast since the middle of the last decade. The unrest across the Middle East dubbed the "Arab spring" reinforced this.

Protesters in Tunisia and Egypt – who achieved in a few weeks what Bin Laden and al-Qaida had spent years trying to do by deposing the rulers of Egypt and Tunisia – shouted pluralist, democratic slogans and rejected any violence. Al-Qaida and, perhaps more important, al-Qaidaism have now been forced to the ideological, social, political and geographical periphery of the Islamic world. Though some of the alienated and the angry are likely to be attracted to extremism, particularly if their currently high aspirations are not met, the masses have already rejected Bin Laden, his ideas and his methods.

Though the killing is unlikely to have much of a deterrent effect – expert Thomas Hegghammer said recruits were already fully aware of the dangers of what they were doing – it will nevertheless remove a key focal point in the disparate landscape of jihad.

"It's much more attractive to be part of something bigger such as al-Qaida than to be a bunch of guys who together can aspire to being the Mujahideen Front of Walthamstow or wherever," said one western intelligence official.

Two clear problems remain, however. One is the potential destabilisation of the volatile south-west Asia region. The war in Afghanistan is already unpopular in America, and killing Bin Laden allows a much more rapid drawdown of men and resources by an increasingly cash-strapped US than might otherwise have been the case. There are fears of a replay of the 1990s when the US lost interest in Afghanistan after the defeat of the Soviet forces, which led to anarchy. The White House has tried to allay such anxieties, particularly on the part of India which is worried about Pakistani influence in Afghanistan, but deep concerns remain.

There is another major fear too. Bin Laden may be gone but one of his legacies is a hugely greater degree of polarisation across the Middle East. Though violence has been rejected, a rigorous interpretation of Islam and deeply conservative identities, customs and worldviews are now much more widespread than they were previously. Levels of anti-Americanism are also at recent historic highs.

This is particularly true in Pakistan. The al-Qaida statement on Friday called for an uprising in Pakistan, "the land where the sheikh was killed". A YouGov poll last week found that 45% of Pakistanis disagreed with the statement that Bin Laden was a mass murderer of Muslims. Junaid Anwar, a clean-shaven economist student studying at a private university only a few hundred metres across the fields from Bin Laden's hideout, was typical. If no passionate supporter, he was equally unwilling to condemn Bin Laden.

"The 9/11 attacks were the product of a CIA conspiracy, a self-inflicted American wound designed to pave the way for global domination," Anwar said. "In Iraq they were going for oil. In Pakistan they want to take control of our land."

There will be a footnote to the death of Bin Laden. A tape, possibly a video, made by him is believed to be working its way through the al-Qaida system. The mass murderer may still have the last word.