After the fall of Malacca in 1511 to the Portuguese, the Johor Sultanate, based on the descendants of the Malaccan Sultanate, was founded by Mahmud's son, Ala'udin Ri'ayat Shah II, in 1528 when he moved the royal court to the Johor River and set up his royal residence in Johor Lama. Johor became an empire spanning the southern Malay Peninsula, Riau Archipelago (including Singapore), Anambas Islands, Tambelan Archipelago, Natuna Islands, a region around the Sambas River in south-western Borneo and Siak in Sumatra together with allies of Pahang, Aru and Champa, and it aspired to retake Malacca from the Portuguese. The Aceh Sultanate in northern Sumatra had the same ambition, which led to a three-way war among the rivals. During the wars, the Johor administrative capital moved several times based on military strategies and to maintain authority over trading in the region. Johor and the Portuguese began to collaborate against Aceh, which they saw as a common enemy. In 1582 the Portuguese helped Johor thwart an attack by Aceh, but the arrangement ended when Johor attacked the Portuguese in 1587. Aceh continued its attacks against the Portuguese, and was later destroyed when a large armada from the Portuguese port in Goa came to defend Malacca and destroy the sultanate.