A 13th-century mosque that fell into disrepair after being used for years as a soap factory, a slaughterhouse and a fort reopened in Cairo on Monday after a long restoration. The Mosque of Al-Zhahir Baybars, built under Mamluk rule in 1268, covers 1.2 hectares north of central Cairo, making it the third largest mosque in Egypt. It required mechanical and chemical restoration to bring it back to its original condition, said Tarek Mohamed El-Behairy, who supervised the restoration. “Some parts were destroyed, some parts have been dismantled because they were structurally unsuitable to remain in the mosque,” El-Behairy told Reuters. “But we were very keen, even in the reconstruction process, to work according to the correct archaeological style.” The restoration, which cost $7.68 million, was co-funded with Kazakhstan and began in 2007. For 225 years, the mosque was either closed, abandoned or had operated for non-religious purposes that contributed to its disrepair and decline. During Napoleon's campaign in Egypt it was used as a military fort, then under Ottoman rule in the 19th century as a soap factory. Later, when the British invaded Egypt in 1882, it was used as a slaughterhouse. Al-Zhahir Baybars was a prominent figure in Egypt's history credited with cementing Mamluk rule in Egypt, which spanned three centuries up to 1517.