The United Nations Security Council (UNSC) has voted on a resolution authorising a no-fly zone over Libya and "all necessary measures" - code for military action - to protect civilians.
Ten of the council's 15 members voted in favour of the resolution, while Russia, China, Germany, India and Brazil abstained.
No votes were recorded against the resolution on Thursday, which was co-sponsored by France, Britain, Lebanon and the United States.
Under the no-fly zone, only military aircraft are forbidden to fly in Libyan airspace. It exempts commercial flights.
In Benghazi, the main opposition stronghold, a large crowd watching the vote on an outdoor TV projection burst into celebration and green and red fireworks filled the air.
The resolution came just a few hours after Muammar Gaddafi, the embattled Libyan leader, warned residents of Benghazi that his forces would show "no mercy" in an impending assault on the city.
"The matter has been decided ... we are coming," he said in a radio address on Thursday.
The Libyan leader called pro-democracy fighters in Benghazi "armed gangsters" and urged residents to attack them, saying: "You all go out and cleanse the city of Benghazi.
"We will track them down, and search for them, alley by alley, road by road ... Massive waves of people will be crawling out to rescue the people of Benghazi, who are calling out for help, asking us to rescue them. We should come to their rescue."
'We will be crazy too'
In an interview broadcast just before the Security Council voted on the resolution, Gaddafi dismissed its actions.
"The UN Security Council has no mandate. We don't acknowledge their resolutions," he told the Portuguese public Radiotelevisao Portuguesa.
He pledged to respond harshly to UN-sponsored attacks. "If the world is crazy, we will be crazy too," he said.
Speaking to reporters in Tripoli after the vote, Khalid Kaim, the Libyan deputy foreign minister, took a conciliatory tone, offering to negotiate a ceasefire with the rebels.
"We are ready for this decision (a ceasefire) but we require an interlocutor to discuss how to implement it," Kaim told a news conference.
"We discussed last night with the UN envoy (for Libya, Jordan's Abdul Ilah Khatib) and asked legitimate questions on the application of a ceasefire," he said.
Kaim indicated that Libya would "react positively to the UN resolution, and we will prove this willingness while guaranteeing protection to civilians."
Speaking to Al Jazeera, Alain Juppe, the French foreign minister, said there was not much time left for the international community to act.
"France is very much involved in this action and has prepared the draft resolution. We have one goal… we want to stop the attacks by the Gaddafi regime against civilian populations.
"And it's a question of days or hours because the pressure against Benghazi, especially, is now very tough."
Diplomats indicated that air strikes from a coalition led by Britain, France and the United States could be imminent; however, the UN resolution rules out sending foreign ground troops.
Susan Rice, the US ambassador to the UN, said "This resolution demands an immediate ceasefire and a complete end to violence and attacks against civilians,
"The security council has authorised the use of force, including enforcement of a no-fly zone to protect civilians and civilian areas targeted by Colonel Gaddafi, his intelligence and security forces and his mercenaries," Rice said.
Earlier the Libyan defence ministry warned that "any military operation against Libya will expose all air and maritime traffic in the Mediterranean to danger."
"Any civilian or military moving traffic will be the target of a Libyan counter-offensive," the official Jana news agency quoted the defence ministry spokesman as saying.
The latest developments came amid claims and counter-claims about the progress of fighting between forces loyal to Gaddafi and rebels.
The rebels are seeking to end Gaddafi's more than 41-year-old rule.
State television said loyalists were on the outskirts of Benghazi, while the opposition claimed that fighters in Benghazi had shot down two government warplanes.
Opposition fighters in the western city of Zintan, about 120km southwest of the capital Tripoli, said they were
"According to the fighters, forces loyal to Gaddafi are trying to encircle Zintan. There are troop movements around the north and southwest. They expect a big attack on the city. I heard no gunfire this morning. They say they blocked the main column [of tanks] during the night," a witness told the AFP news agency.
Fighting is also raging for the control of Ajdabiya, the gateway to Benghazi.
A doctor told the AFP news agency that fighting was still going on in and around the town, which also guards the road to Tobruk and the Egyptian border in the rebel-held east.
In Tobruk, Al Jazeera's James Bays reported that pro-democracy fighters were concerned that Gaddafi's forces were attempting to encircle the opposition-held areas.
Source:Al Jazeera and agencies