 Over the years, Pahang grew independent from Melakan control and at one point even established itself as a rival state to Melaka until the latter's demise in 1511.In 1528, the last Sultan of Melaka, Mahmud Shah died.Pahang joined forces with his successor, Alauddin Riayat Shah II who established himself in Johor to expel the Portuguese from the Malay Peninsula.