Pensioner Madiha Abdel Alim was heading home to her flat in Alexandria when she looked up and noticed something strange: the 13-storey block in which she lived was suddenly tilting precariously over the narrow road.

Concerned, she immediately contacted the local authorities. “They did nothing,” says Alim. “They said, ‘oh, that’s normal. It’s a very tall building’.” Three days later, the tower toppled and crashed into the building across the road.

Soon, images of the “leaning tower of Alexandria” went viral across Egypt – seen as an emblem of Egypt’s compromised construction industry, its legal loopholes and frequent corruption. Miraculously no one was hurt in the collapse of the Azarita block, but its residents lost their homes and many were forced to take refuge at a local mosque.

The high-rise, which only had permission for four floors but stretched up to 13, was just one unsafe building among an estimated 14,500 in the city of Alexandria alone. Egyptian research group the Built Environment Observatory estimates that each year “around 200 people lose their lives, and over 800 families are made homeless as a result of over 390 residential building collapses a year”.

As part of its latest tourism campaign, Egypt designed a new attraction called "the leaning tower of Alexandria." Eat your heart out Italy. pic.twitter.com/Eszva0GLSg — DT Debye (@david_debye) June 2, 2017

After leaning for 21 days, the tower was finally demolished last week by a team of engineers led by the army. The general in charge, who asked to remain anonymous, said the demolition was one of the most complex they had ever undertaken.

The Azarita block was destabilised in late May when one Ramadan evening, the much older building next door collapsed, according to Alim. Her block – which was several storeys higher than legally allowed – had been held tightly in place by the surrounding buildings, its foundation rods “short as the legs on a coffee table”, as Alim puts it. Without external support, the building began to lean over.

It’s a stark example of many hurriedly constructed developments that are quickly replacing Alexandria’s rich but deteriorating architectural heritage. Dr Islam Asem, president of the city’s tour guides syndicate, says it was around the time of the Egyptian Revolution, in 2011, that “Alexandria’s [built environment] really declined”.

No one seems optimistic that the collapse will be a wake-up call to the government or the municipal authorities. Photograph: AP

He describes how weak governance in the following years has undermined Alexandria’s strict construction laws. At the same time, demand for housing has spiralled thanks to a booming population, a precarious economy, and a tendency for citizens to prioritise property as the main form of financial security.

Though the law is clear on maximum building heights – which allows new constructions to rise no more than one and a half times the width of the road it is built on – building inspectors can be persuaded to apply only a fine, rather than place a demolition order and instigate legal action if the rules are breached. The sum of the fine varies, but is often covered by the landowner’s profit from renting flats in the illegal higher floors.

Hamza Mostafa is a building inspector in Alexandria. Though he claims he didn’t need to take bribes to supplement his government salary of 2,000 Egyptian pounds per month (£86), he says, “everyone takes [bribes] from that,” alleging that many of his colleagues, including the head of the district he works for, are involved in some form of corruption.

It is well known among developers that Egyptian property law favours occupants, so they often sell off the top floors of a new development first – therefore protecting the lower floors from demolition orders. “Everybody blames somebody else,” Mostafa says. But legally speaking, the buck stops with what is colloquially known as a kahool (a scapegoat), usually someone with little to lose who agrees to be named as the landowner in exchange for a cash lump sum. The Azarita building’s kahoola – in this case a woman – is currently in custody.

These buildings are like layer cakes

Despite widespread knowledge of the ineffective laws, the industry does nevertheless satisfy housing demand; and given a dearth of other options, many residents are willing to take the risk and live in unsafe or illegal housing.

Sarah al-Khateeb and her husband Ramy Ahmed live near the now demolished tower. When they put the deposit down for their flat, they knew that the planned eight-storey development had permission for only four storeys, but were assured the building standards would be good enough.

But soon after they moved in, the building grew to 18 storeys. “They go up three floors in a weekend. We’ve seen it … they don’t even get the cement to harden. And so these buildings are like layer cakes,” says al-Khateeb.

It’s a calculated risk many Alexandrians must take. “I’m just waiting for an earthquake,” he says. One quake in Cairo in 1992 killed more than 500 and left 50,000 people homeless; it was unusually destructive for its size because it hit so many poorly constructed buildings.

Workmen begin to demolish Alexandria’s ‘leaning tower’. Photograph: AP

The residents of the Azarita building have been granted 100 EGP per day in living allowance and temporary accommodation, according to the state newspaper al-Ahram; 21 new permanent homes have been allocated to residents so far. But many evacuees are unwilling to leave the area, where their jobs and communities are based.

Alim and her husband were offered shelter at the charity Gam’ayat Mostafa Kamal al-Khayriyya in Kafr Abdo, miles from the neighbourhood, where women were directed to one hall and men to another. “It was very humiliating,” says Ismail Abdel Meneim Abdo, her husband. “I said, ‘why should we do this, let’s leave’ – we were crying. Why should we stay here when we could stay in the mosque in Azarita, where we know things?”

Of the government allowance, the couple say they claimed six days’ worth of living allowance between them (£26) before giving up. To collect it from the ministry, they faced queues, chaos, and were treated poorly by officials. “It is unpleasant,” says Abdel Alim. “They are not dealing with us in a nice way.”

Despite the coverage and notoriety of Azarita, no one seems optimistic that the collapse will be a wake-up call to the government or the municipal authorities. “You have to wait until the [building is] dangerous, and then they solve the problem,” says building inspector Mostafa, who is frustrated by handing in non-compliance orders only to see them evaded.

Al-Khateeb agrees. “Just because the media is around, they [the authorities] have got to look good. But two weeks from now – ”

Her husband Ahmed chimes in: “Two weeks after this, everything will be back to zero. Back to zero.”

Some names have been changed

Follow Guardian Cities on Twitter and Facebook to join the discussion, and explore our archive here