The ancient walls of Heliopolis had a circumference of a little less than . Much of the extant fortifications around the complex date to the 13th century reconstruction undertaken by the Mamluk sultan Qalawun following the devastation of the earlier defenses by the Mongol army under Kitbuqa. This includes the great southeast tower. The earliest round of fortifications were two walls to the southwest of the Temples of Jupiter and Bacchus. The original southern gateway with two small towers was filled in and replaced by a new large tower flanked by curtains, probably under Buri or Zengi. Bahram Shah replaced that era's southwest tower with one of his own in 1213 and built another in the northwest in 1224; the west tower was probably strengthened around the same time. An inscription dates the barbican-like strengthening of the southern entrance to around 1240. Qalawun relocated the two western curtains nearer to the western tower, which was rebuilt with great blocks of stone. The barbican was repaired and more turns added to its approach. From around 1300, no alterations were made to the fortifications apart from repairs such as Sultan Barkuk's restoration of the moat in preparation for Timur's arrival.