After the fall of Malacca to the Portuguese, the descendants of the Malaccan Sultanate, Ala'udin Ri'ayat Shah II, moved the royal court to the Johor River and set up Johor Sultanate in Johor Lama. Johor became an empire spanning the southern Malay Peninsula, Riau Archipelago, 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.
It still 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. Johor and the Portuguese worked together against Aceh, which they saw as a common enemy but the arrangement ended when Johor attacked the Portuguese in 1587.
After Aceh was destroyed by the Portuguese, the Dutch East India Company arrived and formed an alliance with Johor to eliminate the Portuguese. Johor regained authority over many of its former dependencies in Sumatra which had fallen to Aceh while Dutch took over Malacca.
The dynasty of the Malaccan descendants lasted until the death of Mahmud II, when it was succeed by the Bendahara Dynasty, a dynasty of ministers who had previously served in the Malacca Sultanate.
The descendants from Bendahara Dynasty ends after the death of the Sultan Mahmud Shah III. Before his death, Mahmud Shah III had appointed Abdul Rahman as the legitimate Temenggong of Johor-Singapore, marking the beginning of the Temenggong Dynasty. Abdul Rahman was succeeded by his son, Daeng Ibrahim.
Daeng Ibrahim intended to create a new administrative center for the Johor Sultanate under the new dynasty. During his reign, Johor began to be modernized and this was continued by his son, Abu Bakar. Abu Bakar also implemented a constitution known as the Undang-undang Tubuh Negeri Johor and organised his administration in a British style. By adopting an English-style modernization policy, Johor temporarily prevented itself from being directly controlled by the British.
Johor was the last Malay state to accept a British Adviser. Due to overspending, the sultanate faced problems caused by the falling price of its major source of revenue which gave the British an opportunity to intervene in Johor's internal affairs. Johor was brought under British control as one of the Unfederated Malay States in 1914.