The military action by coalition forces in Libya may have helped to prevent a "bloody massacre" in Benghazi, Prime Minister David Cameron has told MPs.

On 21 March 2011, opening a Commons debate on the UN Security Council resolution authorising the intervention, the prime minister claimed that the intervention had begun "just in the nick of time".

Mr Cameron said the intervention was "necessary, legal and right", telling MPs that inaction would have resulted in the "slaughter of civilians".

But he acknowledged that there were "risks", and suggested there would be "unforeseen consequences".

Mr Cameron said that the aim of the military action was to destroy Libyan air defences, enforce a no-fly zone, and protect civilians from troops loyal to Col Muammar Gaddafi.

"Good progress has been made" on these aims, he said.

The PM also argued that the intervention would mean that Libyans would "have a much better chance of determining their destiny".

"In taking this action, we should be proud that we are not only acting in British interests but being true to our values as a nation," he concluded.

Labour leader Ed Miliband told the Commons: "It is a just cause, with a feasible mission and it has international support."

Mr Miliband compared leaving Libyans to their fate with failure to intervene in the Spanish Civil War, saying: "As we saw the defenceless people of Libya attacked by their own government, it would equally revolt the conscience of the world to know we could have done something to help them, yet chose not to."

But he added: "We should be clear in this House about the degree of difficulty of what we are attempting: to secure a coalition from beyond western powers to support intervention in another North African state. And we cannot afford mission creep, therefore - including in our public pronouncements."

Labour former defence secretary Bob Ainsworth expressed concern over the "enthusiasm" for the operation displayed by some newspapers and "parts" of the Commons.

He said he was a "late and reluctant supporter" of the military action, but he criticised his successor at the MoD, Dr Liam Fox, accusing him of "loose talk" for suggesting Colonel Gaddafi could be a "legitimate target".

Part two of the debate, including the vote on the UNSC resolution, can be found here.