The struggle to a impose a new order on the capital presents a crucial test of the rebel leadership’s many pledges to replace Colonel Qaddafi’s bizarre autocracy with the democratic rule of law, and it could have consequences across the country and throughout the Arab world.

Unlike the swift and largely peaceful revolutions in Tunisia and Egypt, the Libyan insurrection was the first revolt of the Arab Spring to devolve into a protracted armed struggle, and at times threatened to descend into a civil war of factions and tribes.

A rebel failure to deliver on their promises of justice and reconciliation here in the capital could spur Qaddafi loyalists around Libya to fight on. And an ugly outcome here might discourage strong foreign support for democracy movements elsewhere.

For now, governments throughout the West and the Middle East welcomed the rebels’ victory and pledged to assist them in the transition. The European Union said Monday that it had begun planning for a post-Qaddafi era, and Turkey’s foreign minister, Ahmet Davutoglu, said he would fly to Benghazi on Tuesday to meet with the rebel leader, Mustafa Abdel-Jalil, the semiofficial Anatolian Agency reported.

Egypt formally recognized the rebel Libyan government on Monday, calling the Transitional National Council the “new regime.” Mohammed Amr, Egypt’s foreign minister, said that the council would take over the Libyan Embassy in Cairo, and would assume Libya’s seat on the Arab League, which is based in Cairo.

France said Monday that it wanted to call a top-level meeting in Paris next week of the so-called Contact Group of nations supporting the Libyan rebels: the United States, Britain, several Arab states, the United Nations and the Arab League. But the French foreign minister, Alain Juppé, said, “It’s up to the Libyans and the Libyans alone to choose their future and to build a new Libya, which will be a democratic Libya.”