Hundreds of anti-government protesters have clashed with police and government supporters in Libya's second city, in the latest display of unrest in the Arab world.
Dozens of people are said to have been hurt in the clashes in Benghazi.
The overnight unrest followed the arrest of an outspoken government critic, who was reportedly freed later.
State TV showed demonstrations in several cities said to be in support of Libyan leader Muammar Gaddafi.
The unrest comes a day before planned anti-government demonstrations on Thursday, dubbed a "Day of Anger", which are being organised via internet social networks.
Pro-democracy protests have recently swept through several Arab nations, with the presidents of Tunisia and Egypt forced to resign amid growing unrest.
But Wednesday's demonstrations were the first display of defiance in Libya, where dissent is rarely tolerated.
Witnesses say that at one stage up to 2,000 people were involved in the overnight protests in Benghazi, which saw a march on government offices in the city.
The protesters are said to have thrown stones and petrol bombs, and set vehicles alight. Witnesses said police used rubber bullets and water cannon to disperse them.
The protests reportedly began after the arrest of Fathi Terbil, who represents relatives of more than 1,000 prisoners allegedly massacred by security forces in Tripoli's Abu Salim jail in 1996. He was later said to have been freed.
One witness, who did not want to be named, told the BBC: "A couple of people in the crowd started chanting anti-government slogans and the crowd took that on.
"But then there were clashes with pro-government supporters and then after a bit the pro-government supporters dispersed and then the security services arrived and they dispersed the crowds with hot-water cannons."
Footage purporting to show the unrest, with protesters fleeing gunfire and a man being shot, was later posted on the internet and used by the BBC and other news organisations. However, subsequent inquiries suggested this was footage originally uploaded more than a year ago.
Violence also flared in at least two other places, the Associated Press news agency reported.
In Zentan, south of Tripoli, hundreds of people are said to have marched through the streets before setting up tents in the city centre. A police station and security forces premises were reportedly set on fire.
And in Beyida, east of Benghazi, police stations were also set alight by protesters, AP reported.
In a speech broadcast on Wednesday evening, Colonel Gaddafi made no mention of the unrest but said the "revolutionaries" would prevail.
"Down with the enemies, down with them everywhere; down with the puppets everywhere, the puppets are falling, the autumn leaves are falling!" Mr Gaddafi said.
"The puppets of the USA, the puppets of Zionism are falling."
In a statement issued after the Benghazi clashes, a senior Libyan official warned that the authorities "will not allow a group of people to move around at night and play with the security of Libya".
It added: "The clashes last night were between small groups of people - up to 150. Some outsiders infiltrated that group. They were trying to corrupt the local legal process which has long been in place.
"We will not permit that at all, and we call on Libyans to voice their issues through existing channels, even if it is to call for the downfall of the government," said the official, who was not identified.
More than 100 members of a banned Islamist militant group were freed from Abu Salim on Wednesday. It is not clear if the Benghazi clashes and the release of the inmates were connected.
The European Union, meanwhile, has urged Libya to allow "free expression".
"We also call for calm and for all violence to be avoided," said a spokeswoman for EU foreign policy chief Baroness Ashton.
Colonel Gaddafi is the Arab world's longest-serving leader, having ruled oil-rich Libya since a coup in 1969.
He has always insisted that the country is run by a series of peoples' committees, though most outside observers believe it is a police state with him firmly in control, the BBC's Jon Leyne reports.
The Middle East has recently seen a wave of protests fuelled by discontent over unemployment, rising living costs, corruption and autocratic leaderships.
This began with the overthrow of Tunisia's leader, Zine al-Abidine Ben Ali, in January. Last week, President Hosni Mubarak of Egypt resigned.
In recent days there have also been anti-government demonstrations in Yemen, Bahrain, and Iran.