Following the defeat of the Malacca Sultanate on 15 August 1511 in the capture of Malacca, Afonso de Albuquerque sought to erect a permanent form of fortification in anticipation of the counterattacks by Sultan Mahmud. A fortress was designed and constructed encompassing a hill, lining the edge of the sea shore, on the south east of the river mouth, on the former site of the Sultan's palace. Albuquerque remained in Malacca until November 1511 preparing its defences against any Malay counterattack. Sultan Mahmud Shah was forced to flee Malacca.