Nick Clegg will promise in a speech today that in a post-Gaddafi Libya, Britain will avoid the mistakes made in Iraq after the removal of Saddam Hussein.

Unlike in 2003, the nations intervening in the Libyan conflict are aware of the problems that will follow the fall of the dictator after four decades in power, he said.

Mr Clegg is expected to tell an audience at the British Council today: "The decision to support military intervention in Libya was not one the UK took lightly, particularly not by those of us who opposed the invasion of Iraq, but was, and remains, necessary, legal and right.

"We went to Libya with a clear humanitarian mandate. And tens, if not hundreds, of thousands of lives have been saved since. Clearly the situation is changing by the minute. Free Libya forces are making progress. Gaddafi's propaganda machine has been dealt a serious blow and his inner circle are abandoning him, one by one."

And despite signs of infighting within the opposition, the deputy prime minister will again voice Britain's support for the rebel Transitional National Council.

"The national transition council is increasingly articulating a vision for a strong, stable, post-Gaddafi Libya, preparations for which are underway," Mr Clegg will tell the British Council audience.

" We are determined to learn the lesson of Iraq – no matter where you are in the conflict, you should already be planning for the peace."

He will also promise that the freedom movements in Tunisia and Egypt will get continued support from the UK.

Mr Clegg is expected to say: "It is increasingly common to hear what was once hailed the Arab Spring now compared to a long, uncomfortable Arab summer. The truth is: we cannot be certain exactly how things will pan out, but the direction of travel is set.

"Youth, technology, a lack of opportunity and inclusion – factors which have collided to create citizens who want more, who know more, who aspire to more but who are denied it at every turn, this year that tension has hit boiling point.

"I want to make it absolutely clear: the UK will not turn its back on the millions of citizens of Arab states looking to open up their societies, looking for a better life."

What could happen next?

Uprising from within Tripoli

With the prospect of Muammar Gaddafi clinging to power looking ever more remote, one way the regime could retain influence is for elements within Gaddafi's inner circle to stage a putsch against him. This scenario is looking increasingly unlikely, however, as the traditional army has largely been disbanded, many members of Gaddafi's government have defected to the rebels, and only fiercely loyal family and tribal members remain by his side. It is not even clear where Gaddafi is. Fawaz Gerges, a Middle East expert at the London School of Economics, says an armed uprising from within Tripoli's neighbourhoods is more likely, and there were signs of such a movement throughout the weekend with gunfire breaking out across the capital.

Negotiated settlement

Another possible endgame is a negotiated peace deal whereby Gaddafi steps aside and potentially leaves the country, with the rebels also allowing safe passage for other regime cronies before setting up a government. This may be a preferred option for many foreign governments, but exhaustive talks brokered by countries ranging from Russia and China to South Africa have largely failed to reach any agreement, although the regime spokesman Moussa Ibrahim did yesterday speak of a ceasefire, a significant change in the defiant language usually proffered by Gaddafi's government. The rebels, however, have largely rejected any talks that do not explicitly dictate Gaddafi's expulsion from the country.

Rebels seize Tripoli by force, TNC takes control

With the rebels advancing on Tripoli, a bloodbath with Gaddafi allies making a last stand looks increasingly likely. If this transpires and the rebels seize the capital with Nato's help, the Transitional National Council – the shadow government based in the de facto rebel capital of Benghazi – would likely take the helm. The TNC has already been recognised as the legitimate government of Libya by many countries, including Britain and the United States. There are, however, deep splits within the rebel leadership.

Rebels seize Tripoli by force, Libya slides into a second civil war

The anger directed by the relatively well-organised rebel faction in the west towards the most chaotic band of opposition fighters in the east is palpable. There are concerns that even if the rebels are triumphant, tribal divisions and infighting among the various factions could sow a second civil war as they jostle for power. The killing last month by an Islamist rebel faction of the opposition military chief, General Abdel Fatah Younes, was an ominous sign of what the future could hold for a post-Gaddafi Libya.