Pakistani security forces fighting the Taliban have virtually regained control of Mingora, but insurgents were still resisting on the outskirts of the main town in the Swat valley, the military said yesterday.

"Mingora is almost secured," military spokesman Major-General Athar Abbas said. "We are facing some resistance on the periphery."

Recapturing Mingora would raise the prospect that some of more than two million people who have fled the conflict zone could soon begin to go home.

Around 300,000 people had lived in Mingora, until the Taliban occupied the town in early May when the army launched an offensive in Swat.

The mass exodus from the valley, and the neighbouring regions of Lower Dir and Buner, where fighting had broken out in mid-April, has created a potential humanitarian crisis.

The military said more than 1,200 militants had been killed and 42 captured since the fighting began, while 90 soldiers have been killed and 60 wounded. No independent casualty estimates are available.

The government ordered the army into action after the militants moved south from their stronghold in Swat into Buner, a valley just 100km from Pakistan's capital Islamabad.

Islamist militants have carried out a series of bomb and gun attacks in Pakistani cities during the last few days, in a bid to take the heat off their comrades retreating in Swat.