Up to 500,000 terrified residents of Pakistan's Swat valley have fled or else are desperately trying to leave as the military steps up an operation using fighter jets and helicopter gunships to "eliminate" Taliban fighters.

As the military intensified what may be its most determined operation to date against militant extremists, the UN said 200,000 people had already arrived in safe areas in the past few days while another 300,000 were on the move or were poised to leave.

The escalation of the operation came after Pakistan's Prime Minister, Yousaf Gilani, made a public appeal for unity. In a televised address on Thursday evening, Mr Gilani said: "I appeal to the people of Pakistan to support the government and army at this crucial time. We pledge to eliminate the elements who have destroyed the peace and calm of the nation and wanted to take Pakistan hostage at gunpoint."

Download the new Independent Premium app Sharing the full story, not just the headlines

The struggle to drive the Taliban from Swat comes amid intense pressure from the US and deepening anxiety in Pakistan about the spread of the militants to areas no more than 60 miles from Islamabad. The government had initially hoped to bring an end to two years of violence in the former tourist haven by signing a controversial peace deal which saw it agree to the establishment of sharia law in the valley and in neighbouring areas. However,the ceasefire appeared to encourage Taliban militias and their fighters slipped into the adjacent area of Buner.

Last night a military spokesman, Major-General Athar Abbas, told a Pakistani television channel: "To a rough estimate there are between 4,000 to 5,000 militants present in Swat. We are looking forward to the return of the writ of the state."

Yet the operation – which the military says had already killed scores of militants – could yet present Pakistan with one of its greatest humanitarian challenges. In Geneva, Ron Redmond, a spokesman for the UN High Commissioner for Refugees (UNHCR), said there was now a "massive displacement in north-west Pakistan".

He added: "The provincial government estimates between 150,000 to 200,000 people have already arrived in safer areas of North West Frontier Province [NWFP] over the last few days, with another 300,000 already on the move or about to move. Those fleeing the latest escalation of hostilities ... join another 555,000 previously displaced Pakistanis who had fled their homes in the tribal areas and NWFP since August 2008. The new arrivals are going to place huge additional pressure on resources."

What also remains unclear is exactly what the military will have to do to clear and secure the Swat valley and how long that might take. While the Taliban may be outnumbered, the offensive is far from one-sided. "They are putting up very stiff resistance, there is no doubt. I don't think this is going to go away very quickly. It will be weeks, if not months," said General Talat Masood, a former military officer turned analyst. "But it's not just about pushing them back. The military then have to hold the territory and then set in place the administrative structure that will give people confidence to return."

The military operations are taking place in three districts over some 400 square miles. Much of the fighting has been in the city of Mingora, home to 360,000 people before the insurgency. Among those who remain, some have said they had been prevented from leaving by the Taliban who may to use them as human shields.