The joyful ceremony formally marking the end of Moammar Gadhafi's 42-year tyranny was also clouded by mounting pressure from the leaders of the NATO campaign that helped secure victory to investigate whether Gadhafi, dragged wounded but alive out of a drainage ditch last week, was then executed by his captors.
The circumstances of Gadhafi's death remain unclear. In separate accounts late Sunday, two Libyan fighters said Gadhafi was hurt after being captured, but was able to stand. One said that when he and others placed Gadhafi in an ambulance, the former Libyan leader had not yet suffered what Libya's chief pathologist said was a fatal gunshot to the head.
Critics said the gruesome spectacle of his blood-streaked body laid out as a trophy for a third day of public viewing in a commercial freezer tests the new leadership's commitment to the rule of law.
Britain's defense secretary, Philip Hammond, said the Libyan revolutionaries' image had been "a little bit stained" by Gadhafi's violent death. Both he and U.S. Secretary of State Hillary Rodham Clinton said a full investigation is necessary.
Gadhafi's capture and the fall of his hometown of Sirte, the last loyalist stronghold, set the stage for the long-awaited declaration of liberation, delivered by the head of the National Transitional Council, Mustafa Abdul-Jalil.
He did not mention the circumstances surrounding Gadhafi's death -- mobile phone videos showed the wounded leader being taunted and beaten by a mob after his capture. But he urged his people to avoid hatred.
"You should only embrace honesty, patience, and mercy," Abdul-Jalil told a flag-waving crowd of several thousand at the declaration ceremony in the eastern city of Benghazi, the birthplace of the uprising against Gadhafi.
Abdul-Jalil laid out a vision for a new Libya with an Islamist tint, saying Islamic Sharia law would be the "basic source" of legislation, and that existing laws that contradict the teachings of Islam would be nullified.
He outlined several changes to align with Islamic law, including putting caps on interest for bank loans and lifting restrictions on the number of wives Libyan men can take. The Muslim holy book, the Quran, allows men up to four wives.
Abdul-Jalil thanked those who fought and fell in the war, saying they "are somewhere better than here, with God." Displaying his own piety, he then stepped aside from the podium and knelt to offer a prayer of thanks.
Using Sharia as the main source of legislation is stipulated in the constitution of neighboring Egypt. Still, Egyptian laws remain largely secular as Sharia does not cover all aspects of modern life.
Libya's revolt erupted in February as part of anti-government protests spreading across the Middle East. Islamist groups stand to gain ground in neighboring Tunisia and Egypt, which shook off their dictators several months ago. Tunisia has taken the biggest steps so far on the path to democracy, voting Sunday for a new assembly, while Egypt's parliamentary election is set for next month.
Libya's struggle has been the bloodiest so far in the region. Mass protests turned into a civil war that killed thousands and paralyzed the country. Gadhafi loyalists held out for two more months after the fall of the capital of Tripoli in late August. Gadhafi's hometown of Sirte fell last week, but Gadhafi's son and one-time heir apparent, Seif al-Islam, apparently escaped with some of his supporters.
The anti-Gadhafi forces enjoyed strong Western political and military support during their revolt, especially from the U.S., Britain and France, and NATO airstrikes were key to their victory.
Abdul-Jalil paid tribute to the Gulf Cooperation Council, a six-nation alliance led by Saudi Arabia, the Arab League and the European Union. NATO performed its task with "efficiency and professionalism," he said.
President Barack Obama congratulated Libyans on the declaration.
"After four decades of brutal dictatorship and eight months of deadly conflict, the Libyan people can now celebrate their freedom and the beginning of a new era of promise," he said.
In Brussels, NATO Secretary-General Anders Fogh Rasmussen welcomed the declaration and said NATO's mission in Libya "is very close to completion," referring to the alliance's decision to end air patrols on Oct. 31.
In Libya, leaders have said a new interim government is to be formed within a month, following by elections for a constitutional assembly within eight months. Elections for a parliament and president would follow in the year after that.
Gadhafi's body remained on display Sunday in a produce locker in the port city of Misrata, which suffered from a weeks-long bloody siege by regime forces in the spring. People have lined up since Friday to view the body, which was laid out on a mattress on the freezer floor. The bodies of Gadhafi's son Muatassim and his ex-defense minister Abu Bakr Younis also were put on display, and people wearing surgical masks filed past, snapping photos of the bodies.
It remains unclear what happened between the time Gadhafi was captured alive in Sirte on Thursday and arrived dead in Misrata. Libyan leaders say he was killed in crossfire during battles for Sirte, but revolutionaries who were present for Gadhafi's capture -- and even one who was in the ambulance with him -- said nothing about additional fighting in interviews with The Associated Press.
Dr. Othman al-Zintani, Libya's chief forensic pathologist, said he performed an autopsy that confirmed that Gadhafi was killed by a gunshot to the head. That finding did not clear up the circumstances of his death, and al-Zintani said he could not elaborate until a full report has been sent to the attorney general.
Al-Zintani told the AP that Gadhafi's body was removed from the freezer and taken to a secret location for the autopsy. He said he also examined the body of Muatassim.
In new testimony late Sunday, two fighters said revolutionary forces encountered heavy resistance from Gadhafi loyalists near the drainage tunnel where Gadhafi and others were hiding.
Omar al-Shibani, commander of a group of fighters involved in the capture, said one of his men found the wounded Gadhafi in the tunnel, disarmed him, pulled him out and walked him to one of the fighters' vehicles.
Another fighter at the scene, Jibril Othman, said it was difficult for Gadhafi to stand. According to both accounts, the fighters put Gadhafi on the hood of the vehicle, and drove with him for some distance. Othman said a crowd gathered, and that he and others were beating Gadhafi.
Othman said that when Gadhafi was eventually placed in an ambulance, he had not yet suffered a shot to the head. Al-Shibani said Gadhafi had been shot in the abdomen and suffered a head injury, but that he "was fine up to that point."
The New York-based group Human Rights Watch, which viewed the bodies, said video footage, photos and other information it obtained indicate that Moammar and Muatassim Gadhafi "might have been executed after being detained."
"Finding out how they died matters," said Sarah Leah Whitson of Human Rights Watch. "It will set the tone for whether the new Libya will be ruled by law or by summary violence."
Mahmoud Jibril, the acting Libyan prime minister, said he would not oppose an inquiry into Gadhafi's death, but added that there is "no reason" to doubt the credibility of an official report that he died in crossfire.
Addressing the celebrations around Gadhafi's body, Jibril told the BBC in an interview on Sunday: "You have to appreciate the agony that people went through for 42 years."