IT’S BEEN less than nine months since the final downfall of Moammar Gaddafi, the dictator who ruled Libya for 42 years and who left it with no recognizable political institutions, no rule of law and no established political parties. Given that history, and the predictions that NATO’s support for last year’s rebellion against the Gaddafi regime would produce Somalia-like chaos in the oil-producing state, Saturday’s general election was a remarkable achievement.

Election authorities said 1.8 million voters — a turnout of 65 percent — cast ballots for an interim National Assembly in which 3,700 candidates competed for 200 seats. There were, of course, some irregularities and scattered episodes of violence, but more than 90 percent of election stations opened, and the chief of a European Union assessment team said that “nearly all Libyans cast their ballot free from fear and intimidation.”

The initial results, drawn from exit polls and unofficial counts, were also encouraging. A centrist alliance led by former interim prime minister Mahmoud Jibril appeared to have won a plurality, besting Libya’s branch of the Muslim Brotherhood and other explicitly Islamist factions.

Mr. Jibril, who earned a doctorate in political science from the University of Pittsburgh, is regarded as a pro-Western moderate. Though he rejects the labels “liberal” and “secular,” he appears committed to democratic principles. On Sunday. he offered to form a coalition with the country’s other political forces, a proposal that at least some of his opponents appeared to welcome.

The new assembly, which is to form an interim government expected to serve 18 months, will face profound challenges. Parts of Libya are still controlled by armed militias that answer to no central authority; clashes between Arab and non-Arab peoples have afflicted the sparsely populated south; and regional rivalries threaten to derail the constitution-writing process. Originally empowered to write the new charter, the assembly was stripped of that authority days before the election in response to protests from the eastern region centered on Benghazi.

In that context, Mr. Jibril’s initiative to form a broad coalition seems prudent. Libya’s principal political forces may not have major ideological disagreements: There seems to be a consensus, for example, that Islamic sharia law should be one source of the constitution but not the only one. The biggest political challenges may be determining the degree of federalism in the new state and fairly distributing the country’s bounteous oil revenue among a population of 6 million.

That will be easier to do if the new government can succeed in imposing its authority across the country, including disarming militias or integrating them with official security forces, and freeing prisoners from irregular detention. The United States and its NATO allies could help with this: Libyan officials have repeatedly requested assistance with reorganizing and training the army and police forces. NATO’s intervention in Libya last year paved the way for Saturday’s landmark election. Now the Obama administration and its allies should help the new authorities attain their goal of a democratic Libya.