CAIRO (Reuters) - When an explosion in one of Cairo's calmer residential areas reduced a five-story building to rubble, residents feared it was the work of suicide bombers.

Actually, authorities were dynamiting unlicensed buildings, even though millions of Egyptians are desperate for housing - a sensitive issue that the country's new president will face.

After Egyptians vote next month, many will want their new leader - expected to be former army chief Abdel Fattah al-Sisi - to tackle the housing crunch as the population explodes.

Sisi is seen as a decisive figure by supporters. But the man who toppled Egypt's first freely elected president last year has not outlined how he plans to ease the country's social ills, with the housing crisis one of the most challenging.

Many frustrated Egyptians have taken matters into their own hands since the 2011 army-backed uprising which toppled Hosni Mubarak raised false hopes of greater social justice.

They started constructing multi-storey buildings without seeking the required permits or adhering to safety standards that may raise the cost of construction.

Some invested their savings in the rows of unfinished red-brick buildings seen around Cairo's ring road, concluding they would get away with living in illegal flats in the chaos of post-Mubarak Egypt.

But as the government tries to impose order by tearing down those buildings, many Egyptians will find themselves empty-handed, raising the prospect of further unrest in a nation where street protests have removed two presidents in three years.

"All these people will not remain quiet, they stand up against the regime and the ruler," said Adel Soliman, head of the Strategic Dialogue Forum think-tank. "This is one of the biggest problems that will face the government."

Three years of instability has already hammered the economy and frightened away foreign investors. Those conditions fueled the illegal housing boom as shady contractors exploited the mayhem and rising demand for affordable homes.

Officials say at least 450,000 of these buildings were constructed without permits in the past three years.

SHATTERED DREAMS

Now a large number will be torn down, dashing the hopes of people like Safaa Abdelsattar, holding her one-year-old daughter and pacing around her unfinished flat. Nearby, workers were tearing down a building, a reminder of her fate.

Times were good when Abdelsattar moved into an illegally built apartment complex in the Maadi district a year ago. Her salesman husband invested life savings of 125,000 Egyptian pounds. They could only afford to furnish one room.

“This was our dream house. Now people want to come and demolish our dreams. Where will I go with my children?” Abdelsattar asked, her voice trembling as panic sets in.

She, along with other residents, accuse corrupt officials of forging the deeds to the land.

The illegal housing boom was fueled mostly by businessmen or property developers who were well aware of rising demand and wanted to make a quick buck under lax government supervision.

They constructed buildings in a rush, bypassing regulations and sometimes relying on forged documents to sell apartments at bargain prices, said Ahmad, a real estate broker, and two contractors who worked on such buildings.

Now the fate of these buildings is in limbo as officials hunt for illegal or unsafe ones to demolish.

“After the revolution many people started to build on land that is not theirs ... The housing crisis has made people desperate to buy property as soon as it is available,” said Ahmad, an agent who helps people find homes in Cairo.

“This is a real problem. People put their life savings in these housing units and then overnight they will find out that these apartments do not belong to them."

POPULATION EXPLOSION

Egypt's next leader faces a dilemma. Destroying illegal buildings could trigger a backlash in a country whose population has grown by one million people in less than six months. Doing nothing could encourage Egyptians to keep building illegally.

Sisi is not as popular as he was when he ousted President Mohamed Mursi of the Muslim Brotherhood last July and Egyptians will expect him to take on a host of challenges - from an Islamist insurgency to a struggling economy.

The housing issue is especially delicate. It is one of the starkest reminders of the gap between rich and poor, which helped trigger the 2011 revolt.

Poverty in Egypt is among the highest in the world, with one in four Egyptians living on less than $1.65 a day.

While the elite live in gated communities with blossoming gardens and artificial lakes or in luxury flats overlooking the Nile, the poor set up homes anywhere they can. Many have no clean water or sanitation. About half a million people live in a sprawling Cairo cemetery.

“Poverty has driven them to that and the idleness of previous governments over the past 40-50 years has resulted in this. This problem has been accumulating over decades,” said Khaled Gabarty, executive director of the government's Informal Settlement Development Facility.

Egyptian officials say the country will need to provide 500,000 units a year, a target that seems far-fetched for a nation where plans to build affordable units have repeatedly fallen short of expectations.

“I don’t think any government in the world can catch up with such a big number,” Ayman Sami, head of Jones Lang La-Salle's Egypt office.

Sisi is seen by supporters as a someone who will deliver justice and help the poor. Critics accuse him of allowing Mubarak-era officials and businessmen to dominate Egypt once again at the expense of the poor.

To Um Mohamed, who faces eviction soon, little has changed since Mubarak fell.

"We thought that after the revolution the situation would improve. We had no idea that the thieves would return," she said. "They cheated us. We had hope that this country would improve but that did not happen at all."

The government has announced plans to build one million houses for low income individuals in a project worth $280 billion Egyptian pounds, one of the biggest in the region, with the help of the United Arab Emirate’s Arabtec Holding.

But many poor Egyptians remain skeptical.

“Those are not for us, it is not for our level. This is for the soldiers and officers and their people,” said Hind Gomaa, who lives in a building due to be torn down.