Published: March 18, 2011

WASHINGTON — President Obama on Friday ordered Col. Muammar el-Qaddafi to carry out an immediate cease-fire, withdraw his forces from rebel-held cities and stop all attacks on Libyan civilians or face military action from the United States and its allies in Europe and the Arab world.

Moises Saman for The New York Times

Anja Niedringhaus/Associated Press

Rebels brought the body of a government soldier into Benghazi, the opposition's self-described capital, on Friday as pro-Qaddafi forces continued their advance.

“Let me be clear, these terms are not negotiable,” Mr. Obama said from the East Room of the White House. Those terms, particularly lifting the siege of opposition-held territories, would give the rebels a reprieve, if not a military advantage.

Libya had pledged a cease-fire hours before. But reports from rebel-held territory indicated that the attacks by Qaddafi militias continued unabated in the east and west.

Government forces continued to advance on Benghazi, the rebel’s capital in the east, and people fleeing nearby Ajdabiya said troops were shelling and conducting assaults in the afternoon. The western city of Misurata was under siege, its electricity and water cut by the government, and doctors reported that at least 25 people were killed, including 16 unarmed civilians. In Tripoli, the repression of peaceful protests continued, and gunfire was heard late in the evening.

President Obama said he was sending Secretary of State Hillary Rodham Clinton to a meeting in Paris on Saturday to consult with France, Britain and members of the Arab League on further action. An allied military strike on Libya did not appear imminent on Friday night.

Mr. Obama spoke 18 hours after the passage of a United Nations Security Council resolution authorizing military action against Colonel Qaddafi, and as violence raged across the Middle East. In Yemen, security forces and government supporters shot and killed at least 45 protesters. In Bahrain, the government tore down the monument adopted by the country’s rebel movement, the pearl in the middle of Pearl Square in Manama. In Syria, a police state where protest is rare, large demonstrations broke out in four cities.

In contrast to the military intervention in Libya, the administration has restricted itself in those countries to statements condemning the violence and urging restraint.

Mr. Obama used tough language that was at times reminiscent of President George W. Bush before the war in Iraq.

“If Qaddafi does not comply with the resolution, the international community will impose consequences, and the resolution will be enforced through military action,” Mr. Obama said, laying out a policy decision made after several weeks in which the administration sent conflicting signals about its willingness to use force to aid the rebels at a time of upheaval throughout the Arab world.

But unlike Mr. Bush, Mr. Obama cast the United States in a supporting, almost reluctant role, reflecting the clear desire of the Pentagon, which has been strongly resistant to another American war in the Middle East. He said that Britain, France and Arab nations would take the lead, and that United States ground forces would not enter Libya.

The White House and the Pentagon offered no other details on what the precise role of the United States military would be in any strikes against Colonel Qaddafi’s forces, but an administration official said late Friday that the United States might take the lead in an attempt to destroy Libya’s air defenses at the beginning of operations.

“We may do the shaping on the front end,” the administration official said. The official was referring to the ability of American forces, greater than that of the allies, to strike targets precisely from long distances, whether by missiles launched from submarines, surface warships or attack jets.

The official said that the goal was to limit American military involvement to the initial stages of any action, and that it was the administration’s expectation that the allies could control the skies over Libya once Colonel Qaddafi’s air defenses are destroyed.

Mr. Obama’s remarks at the White House capped a day of diplomacy mixed with military threats in Washington, London and Paris, where the allies forged a united front against Colonel Qaddafi. Britain, France and then the United States responded with almost identically worded skepticism after Moussa Koussa, the Libyan foreign minister, announced a cease-fire, his hands shaking, and European officials indicated that they were prepared to move quickly if a decision was made to take military action.

“We will judge him by his actions, not his words,” Prime Minister David Cameron of Britain told the BBC in London.

A few hours later, Mrs. Clinton said in Washington that the United States would be “not responsive or impressed by words.” She said that the allies would “have to see actions on the ground, and that is not yet at all clear.”

In Paris, the French Foreign Ministry spokesman, Bernard Valero, said that Colonel Qaddafi “begins to be afraid, but on the ground, the threat hasn’t changed.”

Obama administration officials said that action against Libya had to include the Arab countries, and they were insistent, as one senior official put it, that the “red, green and black” of Arab flags be prominent in military operations. As of Thursday night, the United States said that it had commitments from Qatar and the United Arab Emirates to contribute fighter jets, and that Jordan had also agreed to take part, although the extent of its participation was not clear on Friday.

Conditions on the ground remained confused and tense in Libya on Friday night. Several hours after Mr. Moussa had declared a cease-fire, explosions could be heard about 30 miles away from Ajdabiya. Residents who left the city after the cease-fire declaration said the announcement of an end to hostilities had in fact caused no break in the fighting.

Two doctors in the city of Misurata said that 25 people were killed on Friday, including 16 civilians.

“What cease-fire?” said Mohamed, a spokesman for the rebels in Misurata. “What lies, what murder!” After watching Mr. Obama’s speech on a generator-powered television at the Misurata medical center, he said, “We are very heartened by Mr. Obama’s words. We feel that he finally grasped the situation and grasped the urgency.”

A spokeswoman for the rebel ruling council, Iman Bugaighis, said on Friday that Colonel Qaddafi’s troops were moving toward Benghazi. “They are using their grenades to shoot up to 30 kilometers,” she said.

But Khalid Kaim, the deputy foreign minister, said emphatically, “We have no intention of entering the city of Benghazi.”

On Friday, residents of Ajdabiya described a vicious battle for their city that had lasted days, killed scores of people and wrecked neighborhoods, including large parts of an area called Seventh of October. They said that Colonel Qaddafi’s loyalists attacked Tuesday from a ring around the city’s outskirts with tanks, missiles and other heavy artillery.

“The houses were shaking,” said a woman named Fatima, who fled with her family on Friday. “We thought it would stop but it didn’t.”

On Wednesday doctors at the hospital in Ajdabiya said 38 people had died in the fighting. By Friday, residents guessed at a far higher number, saying they saw bodies in the streets. Moussa al-Dulaimi, a police officer who fled the city on Friday, said seven neighbors died in the fighting.

The residents described intense shelling around the post office, and especially in the north of the city. Residents were shot at checkpoints and by snipers, they said.

Thousands of refugees have settled about twenty minutes outside of Ajdabiya, on the road to the eastern city of Tobruk, in tents and abandoned homes in the desert. Volunteers from Tobruk bring food, water and fuel to the refugees, who cook on campfires or share small power generators. “The situation is very dangerous. Nobody is going back to the city,” said Khaled Gabally, who left Ajdabiya on Thursday.

By Friday, government tanks were posted most of the city’s entrances, residents said. As people left, soldiers checked for guns and cellphone videos of the violence. A few residents said the soldiers made them repeat an oath: “Only Muammar, God and Libya.”

By early Saturday morning, the Qaddafi government appeared to be laying the groundwork for a potential strike against the rebels in the name of self-defense.

Khalid Kaim, the deputy foreign minister, said government intelligence showed tanks, artillery and weapons from Benghazi attacking a town in the east. Government forces, he said, were holding back to observe the cease-fire.

Elisabeth Bumiller reported from Washington, and David D. Kirkpatrick from Tripoli. Reporting was contributed by Kareem Fahim from eastern Libya; Dan Bilefsky from the United Nations; Helene Cooper, Mark Landler and Thom Shanker from Washington; Alan Cowell and Steven Erlanger from Paris; Julia Werdigier from London; and Steven Lee Myers from Tunis.

A version of this article appeared in print on March 19, 2011, on page A1 of the New York edition with the headline: OBAMA THREATENS MILITARY ACTION AGAINST QADDAFI.