Libya’s top leader declared the country officially “liberated” Sunday from the four-decade rule of Moammar Gaddafi, pledging to replace his dictatorship with a more democratic but also a more strictly Islamic system.

In a speech to a cheering, flag-waving crowd, Mustafa Abdel Ja­lil, head of the Transitional National Council, promised to ban interest on housing loans and scrap other laws that didn’t conform to Islamic jurisprudence.

Although he lacks the power to make such changes himself, his comments, on such a symbolically significant day, suggested that Islam could play a greater role in public life in the new Libya. They also heightened an already intense debate over the role of Islam in the countries transformed by the Arab Spring.

Tens of thousands of Libyans poured into Keish square in Benghazi, the eastern city that was the cradle of the revolution, to celebrate the defeat of Gaddafi in a U.S.-backed eight-month struggle. For a population that had not known freedom of speech or real elections for decades, it marked a dream. Few were bothered by the spectacle hundreds of miles away in the northwestern city of Misurata, where Gaddafi’s body was on public display in a frozen-food locker for the third straight day.

“Lift your head, you are a proud Libyan,” chanted the crowd in Benghazi, as balloons in the colors of the new flag — red, black and green — floated overhead. Some people waved the flags of France and the United States, both of which were part of an alliance that helped the anti­-Gaddafi forces in their struggle.

The new government faces daunting challenges, including persuading scores of militias across the country to lay down their weapons and integrate into a new military and justice system.

“Toppling Gaddafi was the unifying force. Now that he’s gone, will they be able to hold it together?” said a Western diplomat attending the ceremony, speaking to a reporter on the condition of anonymity to be frank.

A first test for the authorities will be putting together a new interim cabinet to take the country to elections in eight months. Under a timeline set by the governing council, the new prime minister and cabinet are to be in place within 30 days. But some observers say it could take longer as regions that felt neglected by Gaddafi — such as Benghazi — press for more power.

Tensions have arisen on the Transitional National Council between Islamists and secularists and between former Gaddafi officials and his longtime foes.

Abdel Jalil, a slight and balding former justice minister, paid homage Sunday to those who lost their lives in the civil war. “This revolution started as peaceful, to demand the minimum. But Gaddafi started killing people with heavy weapons,” he said. Dozens of people in the crowd hoisted gold-framed pictures of relatives who had been killed.

In what surprised some in attendance, Abdel Jalil gave prominence to the role of Islamic law in the new Libya. “We are an Islamic state,” he said, and he pledged to get rid of regulations that didn’t conform to Islamic law.

Among them would be charging interest, he said. “The interest [on loans] will be ruled out. You will not pay it anymore,” he said, to thunderous applause from the crowd. The Islamic banking system prohibits charging interest, which is regarded as usury.

But Islamic law encompasses a wide range of approaches to governance, and senior Libyan officials played down the changes Abdel Jalil was proposing, saying that he wanted to outlaw interest on housing and personal loans, but not on business loans. He also envisioned changing marriage laws to make it easier for men to take a second wife, they said.

“A lot of young ladies lost their husbands in the battle” and want to find new partners, said Farage Sayeh, the minister of capacity-building in the temporary cabinet that stepped down Sunday. Under current Libyan law, a man seeking a second wife must receive his first wife’s permission and appear before a judge.

Libya is a conservative Muslim society, in which alcohol is banned and many women wear head scarves. Gaddafi’s government tolerated little dissent and often repressed Islamists. But Libya’s Islamist groups appear to have emerged as the best-organized among post-revolution political groups. The U.S. government has been uneasy about the prominence of some Islamists among the revolutionaries, but Libya’s new leaders have tried not to alienate them.

In any event, changing Libya’s laws will be time-consuming and will need more than Abdel Jalil’s approval, officials said. Libyans will vote in June for a 200-member body that will rewrite the constitution, putting the country on track for full elections for a new chief executive and parliament.

Abdel Jalil is considered religious but not an extremist. His comments may have been intended to win support from Islamists within the military command, as well as score points with ordinary Libyans fed up with high interest rates on loans.

Western officials and human rights groups continued to express concern Sunday about Gaddafi’s death in custody. U.S. Secretary of State Hillary Rodham Clinton said she would strongly support investigations by the United Nations and the Transitional National Council into the death.

There has been no indication that Libya’s governing authorities ordered Gaddafi’s execution, but cellphone videos depicting revolutionaries kicking and smacking him have raised questions about whether they were the source of the gunshot to his head. An autopsy concluded Sunday in Misurata confirmed that the shot killed Gaddafi, Libya’s chief pathologist, Othman al-Zintani, told the Associated Press.

Libyan officials have said that they are open to calls from human rights groups for an independent investigation of Gaddafi’s body. But the outgoing interim justice minister, Mohammed al-Alagi, told The Washington Post: “I hope you focus on more important questions than this. The Gaddafi issue is over . . . the Libyans lost during this conflict more than 40,000 people because of Gaddafi.”