United Nations (CNN) -- Jubilant Libyan rebels in Benghazi erupted with fireworks and gunfire after the U.N. Security Council voted Thursday evening to impose a no-fly zone and permit "all necessary measures" to protect civilians.

The opposition, with devoted but largely untrained and under-equipped units, has suffered military setbacks this week. It has said such international action was necessary for it to have any chance of thwarting Moammar Gadhafi's imminent assault on the rebel stronghold.

"We're hoping and praying that the United Nations will come up with a very firm and very fast resolution and they will enforce it immediately," said Ahmed El-Gallal, a senior opposition coordinator, before the vote.

"We should not arrive too late," French Foreign Minister Alain Juppe said at the U.N.

The resolution was approved with 10 votes, including those of the United States and the United Kingdom.

There were no opposing votes on the 15-member council, but China, Russia, Germany, India and Brazil abstained. Germany said it was concerned about a protracted military conflict.

U.N. member states can "take all necessary measures ... to protect civilians and civilian populated areas under threat of attack in the Libyan Arab Jamahiriya, including Benghazi, while excluding a foreign occupation force," according to the resolution.

Moments after the vote, anti-Gadhafi forces in Benghazi broke into cheers, waving flags and chanting. Antiaircraft tracer fire lit up the sky at one rally.

UN approves no-fly zone in Libya

Libyan army pushes forward

Libyan amb. still hopeful for airstrikes

UN okays no-fly zone in Libya

It was not immediately clear just how an international military operation and possible strikes against the Libyan military might unfold. The no-fly zone prohibits Libya's air forces from entering certain zones within the country.

The United States and NATO partners have contingencies in place to act within hours, according to an administration official familiar with planning. President Barack Obama will insist on a major Arab role in any no-fly zone, the official said.

The contingencies include air strikes and cruise missile attacks designed to cripple Libyan air defenses and punish military units leading Gadhafi's push on opposition strongholds in the east, the official said.

Obama called British Prime Minister David Cameron and French President Nicolas Sarkozy after the vote. The three "agreed that Libya must immediately comply with all terms of the resolution and that violence against the civilian population of Libya must cease," the White House said in a statement.

Libyan Deputy Foreign Minister Khaled Kaim, speaking in Tripoli, told reporters after the vote that the country will safeguard civilians and its territorial integrity.

He called on the international community to send a fact-finding mission to the African nation but not lend material support to rebels.

A few dozen pro-Gadhafi supporters chanted, "Down with the U.N.! Down with Britain! Down with the United States!"

The U.S. military does not view a no-fly zone alone as sufficient to stop Gadhafi.

Air Force Chief of Staff Gen. Norton Schwartz told a Senate Armed Services Committee hearing on Thursday that establishing a zone would take "upwards of a week."

U.S. military officials have said that a no-fly zone would not halt the heavy artillery the regime is using on the ground.

Gadhafi's son Saadi told CNN Thursday evening that troops will change their tactics and take up positions around Benghazi Saturday or Sunday and assist people fleeing from the city.

The younger Gadhafi said there will be no large-scale assault. Instead police and anti-terrorism units will be sent into the rebel stronghold to disarm the opposition. Unspecified humanitarian groups can help with the exodus of civilians from Benghazi, Saadi Gadhafi said.

In a radio address aired on Libyan state TV, Gadhafi criticized residents of Benghazi and called them "traitors" for seeking help from outsiders.

The Security Council resolution condemns the "gross and systematic violation of human rights, including arbitrary detentions, enforced disappearances, torture and summary executions."

It details enforcement of an arms embargo against Libya, the freezing of assets and a ban on most flights.

"The United States stands with the Libyan people in support of their universal rights," said U.S. Ambassador to the U.N. Susan Rice.

The resolution deplores the use of mercenaries by Libyan authorities, expresses concern about the safety of foreign nationals and demands an immediate cease-fire. Kaim said the Gadhafi government supports a cease-fire, but is working out certain details.

The Arab League's U.N. ambassador, Yahya Mahmassani, said two Arab countries would take part in a no-fly zone operation, but he was not sure which two.

U.N. Secretary-General Ban Ki-moon said the Arab League will be critical to the response to Gadhafi, and that he will travel to the region "to advance our common efforts in this critical hour."

British Foreign Secretary William Hague said the U.N. vote shows the need for Libyan citizens "to have a more representative government."

Earlier Thursday, Libyan state TV said Benghazi would soon come under attack.

Gadhafi said that his forces would enter the city to rid it of those "traitors" and that his forces will search everyone for weapons. He added that his forces gave amnesty to those who gave up their weapons in the city of Ajdabiya. "We will not allow further bloodshed among Libyans," Gadhafi said.

"Search for the traitors, for the fanatics. Show them no mercy. We will look for them behind every wall," Gadhafi said. "This farce cannot go on."

There were air strikes on Benghazi's airport Thursday, with three blasts hitting the site about 30 kilometers (about 18 miles) outside the city.

The opposition has been using the airport to launch its own air strikes, using a handful of jets that rebels have managed to get off the ground, opposition leaders said.

It is not clear that Gadhafi's ground forces are actually within striking range of Benghazi, but they have been fighting their way in that direction for several days.

State TV claimed Thursday that Gadhafi's forces were in control of Ajdabiya, on the road to Benghazi, a claim disputed by opposition leaders.

El-Gallal, speaking from eastern Libya, said "morale is high" and people do not want to leave strongholds because Gadhafi "is willing to kill everybody here."

The government forces have taken control of the eastern and western gates to Ajdabiya and are trying to breach the inside, opposition leaders said. The opposition says it controls the southern entrance.

The opposition says it has a handful of jets that are no match with Gadhafi's superior air power and a pair of Russian-made "Hind" attack helicopters.

Ajdabiya is the last major point between pro-government forces and Benghazi. If it is retaken by pro-Gadhafi forces, it would give access to roads leading to the heart of the opposition's base.

In remarks to the U.S. Senate Foreign Relations Committee, William Burns, the under secretary for political affairs at the State Department, said Gadhafi's forces are only about 160 kilometers outside Benghazi.

"They've made advances, taking full advantage of their overwhelming military superiority in military firepower," Burns said.

He expressed fear that Gadhafi, now isolated by the world community, could turn to terrorism again.

"I think there is also a very real danger that if Gadhafi is successful on the ground, that you will also face a number of other considerable risks as well: The danger of him returning to terrorism and violent extremism himself, the dangers of the turmoil that he could help create at a critical moment elsewhere in the region," Burns told the committee.