Pakistan's government has compared the impact of the country's devastating floods to the country's partition from India as it revealed more than 20 million people had been made homeless by the disaster.

The prime minister, Yousaf Raza Gilani, said the country faced challenges similar to those during the 1947 partition of the subcontinent into Hindu-dominated India and Muslim-majority Pakistan in which about 500,000 people were killed in mass violence and thousands of families were torn apart as 10 million refugees crossed the new border.

Gilani said 20 million people were now homeless and called on Pakistanis to rise to the occasion, amid growing fears of social unrest or even a military takeover following the government's shambolic response to the floods.

"The nation faced the situation successfully at that time [of the partition] and inshallah [God willing] we will emerge successful in this test," he said.

About 1,600 people have died in the floods and aid agencies expect the toll to rise due to outbreaks of deadly waterborne diseases. A case of cholera was confirmed today in Mingora, the main town in Swat Valley in the north-east of the country, and UN aid workers are taking proactive measures to try to avert a crisis.

A UN humanitarian operations spokesman, Maurizio Giuliano, said at least 36,000 people believed to have potentially fatal acute watery diarrhoea (AWD) were being treated for cholera.

"Given that there is a significant risk of cholera, which is a deadly and dangerous and a potentially epidemic disease, instead of focusing on testing, everyone who has AWD is being treated for cholera," he told Reuters.

Aid agencies have warned that 6 million children are at risk of life-threatening diarrhoeal diseases, malnutrition and pneumonia. Stagnant flood plains in densely populated, poverty-stricken urban areas may become breeding grounds for cholera, mosquitos and malaria.

A spokesman for the UK Disasters Emergency Committee (DEC) said: "It's extremely worrying that we are seeing the confirmation of our fears.

"We now have to work very hard to prevent the spread of the disease. The danger is that cholera is both deadly and spreads incredibly easily. Unfortunately the circumstances in Pakistan are against us."

The floods, triggered by torrential monsoon downpours just over two weeks ago, engulfed Pakistan's Indus river basin. Relief operations have yet to reach an estimated 6 million people, fuelling long-held grievances in the flood-hit areas. Villages have been wiped away. Some people only have a patch of land to stand on. But the impact of the disaster will be felt throughout Pakistan's population of 170 million.

President Asif Ali Zardari, who has drawn criticism for going abroad to meet the leaders of Britain and France as the crisis unfolded, today vowed to rebuild the devastated country.

"Despondency is forbidden in our religion. We consider it as a test from Allah for us. This is a test for us and for you," he told flood victims at a relief camp. "We will try to meet all your wishes. We will build a new house for you. We will build a new Pakistan."

Fears that Zardari could be overthrown – possibly through an intervention by the army – have grown as rescuers continue to struggle to help the millions of people affected.

Najam Sethi, editor of the weekly Friday Times, said: "The powers that be, that is the military and bureaucratic establishment, are mulling the formation of a national government, with or without the PPP [the ruling Pakistan People's party]. I know this is definitely being discussed. There is a perception in the army that you need good governance to get out of the economic crisis and there is no good governance."

Other analysts say a military coup is unlikely because the army's priority is fighting the Taliban insurgency, and taking over during a disaster makes no sense.

In Sindh province, flood victims have complained of looting and there are signs of increasing lawlessness.

Gilani and the opposition leader Nawaz Sharif vowed to work together to tackle the crisis.

"Politics at this time is haram [forbidden by Islam]," Sharif said in a joint news conference.

The agricultural heartland has been wiped out, which will cause spiralling food prices and shortages. Many roads and irrigation canals have been destroyed, along with electricity supply infrastructure.

"The immediate risk is one of food riots," said Marie Lall, an Asia expert at Chatham House. "There is already great resentment in Swat and Khyber Pakhtunkhwa province where people had to be cleared during the government offensive. Now there is the threat of social unrest as various factions, families and ethnic groups compete with each other in the event of a breakdown in government."

The World Bank estimates that crops worth $1bn (£640m) have been ruined and the Pakistani finance secretary warned today that the disaster would cut the country's growth in half.

The government may have to spend $1.7bn on reconstruction, and has said it will have to divert expenditure from badly needed development programmes.

Fresh downpours could bring more destruction and displacement. Scattered showers with heavy downpours are expected in the upper north-west, upper Punjab, parts of the north and Kashmir over the next 24 hours, according to Pakistan's meteorological department.