* Libyans told to "Raise your head up high"
* Tens of thousands of flag-waving Libyans gather for ceremony
* Official says Gaddafi in "garbage bin of history" (Adds quotes from attendee, analyst)
BENGHAZI, Libya, Oct 23 Libya declared its liberation on Sunday after 42 years of one-man rule by Muammar Gaddafi came to an end with his capture and death last week, setting the North African state on course for a transition towards democracy.
"Raise your head high, you are a free Libyan," the vice chairman of the interim National Transitional Council, Abdul Hafiz Ghoga, told a tens of thousands of cheering and flag-waving Libyans in the eastern city of Benghazi.
"Libya, Libya, Libya," they chanted back at a ceremony in the city where the uprising against Gaddafi began in February and where interim council has been based.
One speaker mocked Gaddafi, saying he would be consigned to the "garbage bin of history", after the former leader was caught hiding in a drain on Thursday and killed the same day in chaotic circumstances. Women ululated as officials spoke.
Several speakers referred to years of Gaddafi's "tyranny".
Interim council head, Mustafa Abdel Jalil, began his address by falling to his knees in a ritual to thank God. He said the liberation should be celebrated by "praising God and kneeling".
"I call on everyone for forgiveness, tolerance and reconciliation. We must get rid of hatred and envy from our souls. This is a necessary matter for the success of the revolution and the success of the future Libya," he said.
Abdel Jalil declared that Islamic sharia law would be the basis for legislation, echoing previous statements by the interim council on the role of Islam.
"We as a Muslim nation have taken Islamic sharia as the source of legislation, therefore any law that contradicts the principles of Islam is legally nullified," he said, adding this included setting up Islamic banking in the North African state.
Gaddafi had for years ruled the nation according to his idiosyncratic system, outlined in his "Green Book" that he dubbed "The Third Universal Way".
Omar Salabi, a Libyan political researcher from Benghazi University, said Abdel Jalil's comments on Sharia law was not aimed "at business and investment but rather social policy -- for example the financing of people's homes or cars, which should be without interest."
Abdel Jalil thanked Gulf states, Arab League, the United Nations, and the European Union for supporting the uprising. Some in the crowd waved the flag of Qatar, an early backer of the rebels, and U.S. and European flags in tribute to nations which provided planes that bombed Gaddafi's troops.
The intervention by NATO warplanes over Libya in March, after a U.N. resolution was passed, was seen as decisive in turning the rebellion in favour of anti-Gaddafi forces.
Gaddafi had vowed to show "no mercy, no pity" as his forces advanced on Benghazi. Shortly after, NATO planes smashed columns of his heavy weaponry outside the city and opened the way for the rebel fighters to regain the initiative.
"All the martyrs, the civilians and the army had waited for this moment. But now they are in the best of places ... eternal heaven," Abdel Jalil said. "The revolution began as a peaceful one. But it was faced with violence."
"God bless you Abdel Jalil," shouted Akram Al-Tarabakeh, a 39-year-old Libyan at the celebration, reacting to Abdel Jalil's speech. "This is a very decent man. He knows our problems, our needs and what make us happy. God bless him."
Before taking the podium, Abdel Jalil headed to the edge of the stage and leant over to shake hands of those at the front of the crowd, who stretched up to reach him.
Many of the attendees were holding banners with the names of their relatives and friends who died during the revolution, their pictures, the names of the battles they were killed at and the date of their deaths.
The ceremony began with an official saying: "We declare to the whole world that we have liberated our beloved country, with its cities, villages, hill-tops, mountains, deserts and skies."
Sunday's celebration followed a final assault on Sirte, Gaddafi's home town where he had been hiding before apparently trying to make an unsuccessful dash when the city fell. It was the last major bastion of Gaddafi loyalists.
"No doubt we are at a decisive moment in our beloved Libya's history," lawyer Abdel Rahman el-Qeesy said, announcing the creation of a new government portfolio to deal with victims and families of the martyrs of the uprising.
"Libya is the persevering fighter which has made a liar of the tyrant Muammar Gaddafi, the contemptible man who has become a corpse under the feet of our heroes who revolted on Feb. 17 and said to the tyrant 'no'," he said in an impassioned address.
"We are the Libyans. We have shown you who we are Gaddafi, you Pharaoh of the times. You have fallen into the garbage bin of history," Qeesy added.
Omar Hariri, one of the officers who took part in Gaddafi's 1969 coup but was later jailed, said, "We do not differentiate between the civilian revolutionaries and the national army. The blood of both has mixed here on this battleground."
Many fighters learned how to use rifles and other weapons for the first time during the rebellion, creating a rag-tag force that had bags of enthusiasm but lacked a clear command structure and organisation. It often led to chaotic scenes at the front-line. But they gradually matured during the conflict.
Hariri, appointed head of the military by the interim council and one of the interim government's senior military commanders, promised Libya's army would protect the nation.
Speaking as helicopters flew in formation over the crowds, he said, "It will completely side with the people, its doctrine will be protecting the nation, protecting democracy and will not be an aide to a tyrant."
Salah el Ghazal, another official who addressed the crowd, paid tributes to the dead and referred to Gaddafi's demise.
"This is the humiliating end that God wanted to set as example for anyone who practices the worst forms of injustice ... against their people," he said.
The crowd broke out frequently with the rebel cry "Allahu Akbar" or "God is greatest!" (Additional reporting by Marwa Awad, Shaimaa Fayed, Omar Fahmy, Edmund Blair in Cairo and Samia Nakhoul in Amman; Writing by Dina Zayed and Edmund Blair, Editing by William Maclean and Louise Ireland)
Our top photos from the last 24 hours.