Lebanese PM Fuad Siniora has declared victory over terrorism, after the army took control of Nahr al-Bared refugee camp following months of fighting.
Celebratory gunfire was heard in nearby villages as the news spread
Troops had been battling Fatah al-Islam militants at the camp since May but took the group's last positions after its remaining fighters tried to flee.
Fatah al-Islam leader Shaker al-Abssi was reportedly killed in the fighting.
Officials said 37 Fatah al-Islam gunmen and five soldiers died on Sunday. More than 300 people died during the siege.
Troops fired celebratory shots to signal the end of the stand-off, which had forced nearly 40,000 Palestinian refugees to flee the camp.
"It is a great success that the Lebanese army has achieved over the terrorists, those who sought chaos, destruction and tragedies for Lebanon," Mr Siniora said in a televised address to the nation.
Split from Palestinian group Fatah al-Intifada in late 2006
In May, had 150-200 armed men in Nahr al-Bared camp
Denies al-Qaeda links but says it endorses its ideas
Has links with Syrian intelligence, Lebanon says
Leader Shaker al-Abssi now reported dead
He said the Lebanese government would rebuild Nahr al-Bared but added that the camp would be placed under the authority of "only the Lebanese state".
Lebanese security sources said they believed al-Abssi was among the dead after the body of the group's leader was identified by a prisoner.
Blood has been taken from his daughter to carry out a DNA test on the body.
Thousands of people flocked to the camp after news of the end of the siege broke.
Soldiers flew Lebanese flags and fired shots into the air.
One local resident, Amina Sakr, applauded the troops.
She told Agence France-Presse: "This marks a victory for Lebanon because we got rid of this gang of criminals which destroyed our houses, our businesses and our lives."
Troops are still hunting for any escaped militants in the surrounding area of northern Lebanon and the army issued a statement appealing to residents of nearby villages to help in the search.
Army officials said troops were no longer encountering any resistance and have moved inside the camp and are searching for booby traps and unexploded ordnance there.
A BBC correspondent in Lebanon says the fighting at the camp has been the worst internal violence in Lebanon since the end of the civil war in 1990.
Fatah al-Islam, which has been linked to al-Qaeda, emerged in 2006 when it split from Fatah al-Intifada (Fatah Uprising), a Syrian-backed Palestinian group based in Lebanon.
The Lebanese government has also linked Fatah al-Islam to the Syrian intelligence services. Officials in Damascus and Fatah al-Islam deny the connection.