For a brief, happy period on Friday, it seemed that the United Nations security council resolution adopted in New York the previous evening had actually stopped Muammar Gaddafi in his tracks. To general surprise, the Libyan dictator announced an immediate ceasefire, prompting relief and joy among the inhabitants of the besieged rebel city of Benghazi. The commitment by David Cameron, Barack Obama and French president Nicolas Sarkozy to use "any necessary means" to halt Gaddafi's onslaught on his citizens had achieved immediate results. That euphoria did not last long.

Exactly eight years after the US and Britain invaded Iraq, the west is involved – this time with the support of the Arab League – in another deadly and unpredictable military confrontation with a dictator in the Middle East.

Gaddafi's "ceasefire" had proved to be a fiction. His troops penetrated deep into Benghazi, where street battles and an artillery bombardment continued through the day. News reports estimated that at least 26 bodies and more than 40 wounded people had been taken to the city's Jala hospital.

"Do we have to wait till he kills us all before the [world] acts? We are very disappointed," said Adel Mansoura, an air traffic controller fleeing Benghazi. "When we heard the UN resolution, we were very happy and thought we had our freedom, but now we have been left on our own to the killers."

In Paris, where world leaders had gathered to plan the military enforcement of the resolution, there was consternation at Gaddafi's duplicity and a determination to ensure a rapid response. Then the world struck back. The US, France, Britain, Canada and Italy began launching strikes designed to cripple Gaddafi's air defences.

Obama announced: "Today I authorised the armed forces of the United States to begin a limited action in support of an international effort to protect Libyan civilians. That action has begun."

Almost immediately a series of more than 110 cruise missile strikes hit 20 Libyan targets in the cities of Tripoli and Misrata. The western battle to rid the world of one of its most eccentric and violent tyrants had started almost as soon as the Paris summit ended.

Downing Street aides insist that Cameron – previously regarded as uninterested in the foreign stage – had been in favour of international action from the start.

When the prime minister realised, at the end of his statement to the House of Commons on Friday, that he had left the final page of his five-page speech at Downing Street, he did not appear to find any difficulty in speaking off the cuff. Turning to the Speaker, he said: "Mr Speaker, any decision to put the men and women of our armed services into harm's way should only ever be taken when it's absolutely necessary.

"But we simply cannot stand back and let a dictator, whose people have rejected him, kill his people indiscriminately. To do so would send a chilling signal to others striving for democracy across the region. And neither would it be in Britain's interests."

Yet, despite euphoria in the Commons, the path to a UN resolution had been slow and uncertain. On Thursday evening there was still no consensus about the imposition of a no-fly zone even following calls for such a move five days earlier by the Arab League. The resolution was eventually passed by the security council. A Downing Street source said: "It wasn't clear that we would get there until right up to the vote."

One issue throughout, insiders admitted, was the role of America. The UK and France, both smarting from criticisms over their initial stumbling response to the Arab spring, were happy to take the lead on pushing for military action. The French were keen to make up for the blunder of offering riot police to the soon-to-be-overthrown Tunisian regime in the early days of the disturbances.

Aides admitted Cameron was "very frustrated" by criticism he had received for taking arms dealers with him to Kuwait and Egypt shortly after the overthrow of President Hosni Mubarak and the failure to rescue British nationals in the early days of the uprising in Libya. The prime minister was keen to seize control of events.

Distancing the US administration from proposed military action was also, a Downing Street source admitted, part of the process of building support for the UN resolution. Cameron spoke to Obama shortly after it was passed but that was the first time in eight days. It was important, the source said, that this did not look like a western initiative – the shadow of Iraq was ever present.

"We have been thoughtful about the prime minister's interventions, and the first calls on Wednesday night [the evening before the vote] were to Arab countries," said one source. Indeed, while the White House was untroubled by calls from London during the week, Cameron twice rang the prime minister of Qatar, Hamad bin Jassim bin Jaber al-Thani.

The problem with America, however, was the lingering doubt that the Obama administration actually wanted to get involved at all. The most obvious hurdle was Robert Gates, the defence secretary. The only defence secretary to have served under both a Republican and a Democratic president, he speaks quietly, but with a frankness unusual in Washington, and is due to retire at the end of the year, giving him the freedom to be almost as frank in public as he is in private.

Gates made it clear that he thought the no-fly zone would be a mistake, warning that anyone who thought it would be a cost-free exercise was mistaken, and would require bombing Libyan air defences. "Let's just call a spade a spade," he said. "A no-fly zone begins with an attack on Libya."

Earlier, speaking at the West Point military academy, he suggested it would be crazy for a president to embark on another war in the Middle East or central Asia, and at a Nato summit in Brussels last week he succeeded in blocking any move towards a no-fly zone. His concern was that no-fly zones alone could not prevent the massacre of civilian populations, citing Saddam Hussein's slaughter of Shias in southern Iraq after the first Gulf war.

Gates was confident he was winning the argument and that the only thing that would undermine him was if there was some incident, a massacre caught on television that would provoke a sense of moral outrage among the US public.

Such was the frustration in western Europe that Sarkozy, impulsive as ever and with the encouragement of France's philosopher at large, Bernard-Henri Lévy, even spoke of going it alone. "If nobody wants to do it, France will do it by herself," he told a delegation from the Libyan opposition during a meeting at the Elysée at which he announced France would recognise them.

But, while listening intently to Gates, Obama's mind was open. While he and his secretary of state, Hillary Clinton, were sceptical, even as late as Sunday, on whether military action was desirable, they did not rule it out. When Gaddafi then appeared to be pushing back the rebels, Clinton changed course and formed an alliance with a handful of aides to turn the president's head.

With Samantha Power, a senior aide at the National Security Council and Susan Rice, Obama's ambassador to the UN, the three women countered Gates's arguments that Libya was a risk not worth taking. They were able to show Obama that the Arab world wanted action, and while the president seemed at times more concerned with unfolding events in Yemen – where the American Fifth Fleet is docked – he was persuaded within 24 hours of the case for action.

By Tuesday, Obama was convinced that the US needed to act and military plans were ordered and the president engaged himself in persuading key allies of the case. By Thursday night, the plan for military action had the necessary votes and Obama spoke to Cameron again. The question was: how would Gaddafi react?

When, head bowed, Gaddafi's foreign minister, Moussa Koussa, announced an immediate ceasefire on television, shortly after Cameron's statement to the House of Commons, there was talk in Westminster of the "six-minute war". But within Downing Street there were no scenes of celebration, and Cameron continued his round of broadcast interviews, insisting that actions, not words, were what counted now.

The west knows that, despite his shambolic image, troupe of female bodyguards and eccentric behaviour, Gaddafi has remained the most powerful force in Libya for more than 40 years for a reason. He survived international outrage after the bombing of a Pan Am jet over the Scottish town of Lockerbie, killing 270 people, in 1988, and experienced observers of the regime say there is no doubt of his personal determination to survive at any cost.

The latest wheeze from the Libyan leader is to defiantly insist that his country is again the victim of colonial aggression. Libya announced on Friday that it was ceasing all military operations out of respect for the UN, but the tactical nature of the move was underlined by the accompanying complaint that the world body had no right to interfere in the country's "internal affairs".

Officially-approved demonstrations were quickly organised to accuse the US and UN of double standards. "Where was Obama when the Israelis bombed Gaza?" was the loudest theme at one noisy rally by expatriate Egyptians outside the UN mission in Tripoli on Friday. "Where was the UN?" The rebels are routinely dismissed as "terrorist gangs linked to al-Qaida".

"It is very simple to solve Libya's problems," argued one government official. "Let us do it ourselves without foreign or Arab intervention."

But there were signs in the capital that an increasingly isolated Gaddafi was struggling to keep up with the feverish pace of developments over the past few days. Senior Libyans reacted with evident alarm late on Wednesday when it emerged that Russia would not use its UN veto to block the imposition of a no-fly zone. Gaddafi, apparently relaxed in his tent at the Bab al-Azizia compound during a TV interview before Thursday's vote in New York, appeared to be hoping China would hold out.

But if his sharpness of mind was doubted earlier in the week, he appears to have woken up in the past 24 hours, and to ruthless effect. Crowds were seen being encouraged to congregate around potential targets for air strikes. In Gaddafi's headquarters, the Bab Al-Aziziyah compound in Tripoli, crowds massed shouting slogans and holding portraits of Gaddafi while state media was instructed to tell to the world that the rebels were attacking the regime's forces as they retreated from battle zones.

In Britain, the question Cameron was asked in the Commons after his statement on Friday was an understandable one: is the UK capable of such a military endeavour? The prime minister – speaking coincidentally eight years to the day since Tony Blair asked parliament for its backing for the invasion of Iraq – was in no doubt that the country was in good shape for the campaign, and he reminded MPs that the UK was still the world's fourth-biggest spender on defence.

Indeed, it is arguable that one of the figures vindicated by events over the past 48 hours was Liam Fox. The defence secretary has overseen a sometimes brutal, relatively successful, campaign to lessen the size of the cuts to trim the Ministry of Defence's £36bn of debt, arguing that Britain needs to retain its capability to strike quickly and decisively in an increasingly unpredictable world.

Libya, in more ways that one, has bolstered his cause. Only on Thursday – hours before the no-fly zone was approved by the UN – a confident-sounding Fox was promising defence unions that he would still find ways to reduce the fallout of last year's strategic defence and security review, by promising to save thousands of threatened civilian jobs. Yet, just a fortnight earlier, he had kicked off the month by confirming that more than a 1,000 jobs would be axed from the RAF by September, with almost 1,700 to follow. Speculation clouded the future of the Tornado GR4 strike aircraft with reports that the squadron at RAF Lossiemouth would be axed.

Libya, Fox might believe, would put a stop to such reports, reaffirming the need for a varied and sizeable air force. The Tornado, after all, has excelled in battle and is likely to be the first British assets used against Gaddafi.

Shashank Joshi, a doctoral student of international relations at Harvard University's department of government, said: "Tornados can attack ground targets very effectively. They made their name in the Gulf war attacking runways, they are very adept at that." RAF officials are delighted the aircraft has been given the opportunity to demonstrate its ability after an uncertain period. Paul Smyth, an RAF former wing commander and Tornado navigator, said: "We have continued to modernise the Tornado over the years and, germane to what is going on now, [it] has a wider and more advanced set of weapons."

As steps were taken for the movement south of Tornados at RAF Marham in Norfolk and Typhoons at Coningsby, Lincolnshire – aircraft that can outmanoeuvre Libyan jets in air-to-air duels – the reports of fighting in Benghazi had sharpened minds.

Joshi, an associate fellow of the Royal United Services Institute, said that the resolution could precipitate a series of actions against Gaddafi: "The resolution has very elastic phrasing that could stretch from, say, jamming military communications; to stopping the regime from using its radios, its radar; stopping his propaganda in Tripoli if you deem that to be a threat to civilians, in terms of inciting violence. It goes all the way up to inciting ground attacks on his tanks, on his artillery. We certainly have the capability to do that, using guided weaponry, guided munitions of the type used in Afghanistan all the time."

Yet the nightmare scenario is that if the conflict descends into the close-up street fighting that characterised theatres such as Iraq and Northern Ireland it can effectively render superior military technology obsolete. Large-scale collateral damage, civilian casualties resulting from air strikes could bolster support for Gaddafi's forces.

Experts believe that the speed of his forces' offensive against the eastern Libyan city was calculated to ensure that the battleground becomes urban, rather than the flat desert that would have allowed British aircraft to pick off Gaddafi's ground forces.

Joshi believes that UK special forces around Benghazi might have to begin radioing in the target co-ordinates of Gaddafi's military assets to make sure civilians are not at risk. "On the desert road to Benghazi, there is flat terrain and not much cover and you don't have to worry to much about civilians," he said.

"However place a mobile missile platform next to a hospital in an urban area and in some extreme cases you might need special forces on the ground lighting up these targets. Either that or you equip the rebels."

A general consensus in support of the UK Government's involvement in protecting Libyan civilians was evident in the House of Commons on Friday. But critics of the plans for military action are waiting in the wings.

On Friday Germany's foreign minister Guido Westerwelle warned that any military intervention would inevitably lead to "civilian casualties", adding: "There is no such thing as a surgical strike. Every military intervention will have civilian victims. We have to take the lessons from recent history into account."

Nevertheless, whispered conversations in Tripoli reveal hope that the western determination to act means the end is finally approaching for one of the world's most long-lived dictators. At the same time, few Libyans would be surprised if Gaddafi somehow managed to foil the world again.