Determined to save the building, Habashi bought it in 2009, only to be told he could raze it but not restore it. He refused to give up and won the right to restore it in a two-year legal battle. A decade after he bought the building, the restoration is almost complete.
His battle was part of a larger fight to save old buildings which some professional restorers and architects fear is being lost because of bureaucracy, official corruption and laws which they say do little to protect Egypt's architectural heritage.
"I'm not at all optimistic. I believe only 25% of the buildings will survive," said May al-Ibrashy, a restorer who has been working in historic Cairo for about 25 years.
Government officials did not respond to repeated requests for comment for this article.
The five-square-kilometre (about two-square-mile) historic quarter, which has one of the world's biggest collections of Islamic architecture, has been declared a World Heritage site by the United Nations' cultural agency UNESCO.
But though its main monuments are not under threat, many houses and smaller buildings are being demolished.
Government inspectors, fearing they could be held legally responsible for any problems, have declared many centuries-old buildings in danger of collapse since earthquakes in 1992 and 2005. Many have been demolished and replaced by cement and brick high-rise buildings that critics describe as garish.
The demolitions appear at odds with government officials' pledges to maintain Cairo's role as Egypt's "cultural, tourism and heritage capital", despite work on building a new capital east of Cairo to ease pressure on the city of over 20 million.
Those fighting to save old buildings in historic Cairo say the demolitions are destroying a potential stream of tourists and revenue from tourism, which earned Egypt $11.6 billion in 2018, according to central bank figures.
Habashi's bureaucratic nightmare began when he applied for a permit to begin restoring the house soon after he bought it. He said the government replied that the house was condemned as on the verge of collapse and that if he wanted to work at the site, he would have to demolish it and then rebuild it.
Habashi appealed to two state bodies: the Antiquities Authority, responsible for about 600 historic monuments, and the National Authority for Urban Harmony, tasked with preserving many other buildings.
Inspectors from each agency came separately to look at his house, he said.
"They stopped at the doorstep (and said): 'This is a crumbling building. What are you trying to save'" Habashi said.
Only after obtaining a letter from a UNESCO official confirming the building's historic importance was Habashi able in 2011 to secure a court ruling that he could restore it.
Destruction of historic buildings since 2011 has been extensive, said a foreign restorer who studied historic Cairo's Darb al-Ahmar district, much of which is inside the old city walls.
"My analysis is that approximately 15% of the urban fabric in al-Darb al-Ahmar has been replaced by newly built structures seven to 10 stories high," he said. Official figures were not available.
Nearly 100 historic buildings in Darb al-Ahmar were replaced with high-rise buildings as central authority collapsed after the 2011 uprising that ended autocratic president Hosni Mubarak’s 30 years in power, said architect Tarek el-Murri, who has years of experience working in the district.
For art historian Shahira Mehrez, and six others with whom she bought two dilapidated houses, it is convoluted rent control laws that have stymied restoration work. They hope to turn the houses into boutique hotels but have been blocked by people claiming usage rights to rooms and closets in the two houses.
Yet other laws have frustrated Cherif Abdel-Meguid, a hotel developer who since 2007 has bought eight historic houses in the hillside Darb al-Labbana neighbourhood near Cairo’s citadel.
When he applied for permission to restore them, authorities told him four were under demolition orders. To restore them, he must shave a metre or two off the facades to conform with a 1950s law designed to widen streets, he said.
He has not done so. Instead, he has submitted plans to rebuild the insides while preserving the facades, and is awaiting a response.
(Editing by Aidan Lewis and Timothy Heritage) ((firstname.lastname@example.org;))