Pakistani Prime Minister Nawaz Sharif has praised the country's armed forces for defeating militants in the North Waziristan tribal area, which was once considered the main base for the Pakistani Taliban.

In his televised speech during a rare Friday visit, Sharif encouraged people to return to their homes.

Sharif made his remarks as a group of residents gathered in Mir Ali, a main town in North Waziristan, in preparation for the return to their villages and homes.

More than 80,000 people were displaced when the army launched an operation in North Waziristan on June 15 to eliminate local and foreign militants.

The army says it has cleared militants from most of the area and has a comprehensive plan for the phased return of those displaced by the fighting.