The Libyan ambassador to the UK has left the country after being ordered to go following attacks on British embassy premises in Libya's capital Tripoli.
The Foreign Office said Omar Jelban left the UK on Monday evening after being given 24 hours to leave on Sunday.
Crowds attacked foreign missions in Tripoli after reports a Nato air strike had killed one of Col Gaddafi's son's.
The Foreign Office said Gaddafi's regime had a duty to protect embassies.
A BBC team there said the UK embassy building had been completely burnt out.
Meanwhile, the United Nations announced it was withdrawing all its international staff from Tripoli after some of its facilities in the city were also attacked by angry crowds.
In Misrata, the last remaining rebel-held city in western Libya, forces loyal to the Libyan government were shelling the port area on Sunday night. Heavy shelling had occurred in other parts of the city earlier in the day, with some reports saying 12 people had been killed.
UK Foreign Secretary William Hague strongly attacked the Gaddafi regime for allowing the British embassy to be attacked.
"The Vienna Convention requires the Gaddafi regime to protect diplomatic missions in Tripoli," he said.
"By failing to do so that regime has once again breached its international responsibilities and obligations. I take the failure to protect such premises very seriously indeed."
The UK currently has no diplomats in the Libyan capital.
Foreign Office minister Alistair Burt said official lines of communication with Col Gaddafi's government would remain open, as other Libyan officials would stay in its UK embassy after the ambassador's departure.
Reporting after visiting the British embassy in Tripoli, the BBC's Christian Fraser said: "The fires are still burning in the downstairs rooms, there are people climbing through the building, they were throwing things from the upstairs windows while I was there.
"There was also a war memorial that was lying by a car that had been burnt out by the side of the garden."
The US, French and Italian embassies in the Libyan capital were also attacked.
Our correspondent said that while the mob violence could have been spontaneous, because Libya is a police state, "questions will have to be asked why police and soldiers melted into the background".
The UK has taken a lead role in the Nato-led military action against Libyan government forces since the UN Security Council voted on 17 March to use all means necessary - short of foreign occupation - to protect civilians in the country.
This followed an uprising against Col Gaddafi's regime.
UK action has taken the form of attacks by RAF Typhoon and Tornado jets, and missiles fired from Royal Navy submarines.
The RAF is also continuing to enforce the no-fly zone over Libya.
In addition, the UK has sent British military advisers to the rebels.
Col Gaddafi's son Saif al-Arab is reported to have died at his villa in the Bab al-Aziziya compound.
He had a lower profile than most of his brothers, particularly Saif al-Islam, who studied at the London School of Economics and has issued several public statements since the uprising began.
Saif al-Arab had only recently returned to Libya after studying in Germany.
A spokesman for the regime said the Libyan leader himself was in the villa at the time but was unharmed. However, he added that three of Col Gaddafi's grandchildren had also been killed in the attack.
Nato said it had hit a "known command-and-control building" in the area, adding it did not "target individuals".
Prime Minister David Cameron earlier defended Nato's operations in Libya.
"The targeting policy of Nato and the alliance is absolutely clear," he told the BBC.
"It is in line with UN resolution 1973, and it is about preventing a loss of civilian life by targeting Gaddafi's war-making machine."
Mr Cameron did not comment on whether British aircraft were involved in the attack that reportedly killed Col Gaddafi's son.
Shadow defence secretary Jim Murphy said Labour supported action in Libya within the UN mandate.
"Ministers must be clear that there has been no decision to target individuals, which would be beyond the terms of resolution 1973, in order to allay the country's inevitable concerns about changes to military tactics and increased scope of UK military action," he added.