In the early 16th century, the Sultanate of Johor was founded by the Alauddin Riayat Shah II, the son of Mahmud Shah, the last Sultan of Malacca who fled from the invading Portuguese in Malacca. Upon Malacca's defeat to the Portuguese in 1511, Alauddin Riayat Shah II established a monarchy in Johor which posed a threat to the Portuguese. In competition with the Acehnese of northern Sumatra and the port-kingdom of Malacca under Portuguese rule, Johor engaged in prolonged warfare with their rivals, often striking alliances with friendly Malay states and with the Dutch. In 1641, Johor in cooperation with the Dutch succeeded in capturing Malacca. By 1660, Johor had become a flourishing entrepôt, although weakening and splintering of the empire in the late seventeenth and eighteenth century reduced its sovereignty.
-Google