By the 15th century, a kingdom named Beruas had come into existence. Inscriptions found on early tombstones of the period show a clear Islamic influence, believed to have originated from the Sultanate of Malacca, the east coast of the Malay Peninsula, and the rural areas of the Perak River. The first organised local government systems to emerge in Perak were the Manjung government and several other governments in Central and Hulu Perak (Upper Perak) under Raja Roman and Tun Saban. With the spread of Islam, a sultanate subsequently emerged in Perak; the second oldest Muslim kingdom in the Malay Peninsula after the neighbouring Kedah Sultanate. Based on "Salasilah Raja-Raja Perak" (Perak Royal Genealogy), the Perak Sultanate was formed in the early 16th century on the banks of the Perak River by the eldest son of Mahmud Shah, the 8th Sultan of Malacca. He ascended to the throne as Muzaffar Shah I, first sultan of Perak, after surviving the capture of Malacca by the Portuguese in 1511 and living quietly for a period in Siak on the island of Sumatra. He became sultan through the efforts of Tun Saban, a local leader and trader between Perak and Klang. There had been no sultan in Perak when Tun Saban first arrived in the area from Kampar in Sumatra. Most of the area's residents were traders from Malacca and Selangor, and from Siak, Kampar, and Jambi in Sumatra. Among them was an old woman, Tok Masuka from Daik, who raised a Temusai child named Nakhoda Kassim. Before her death, she called on the ancestors of Sang Sapurba to take her place, to prevent the royal lineage from disappearing from the Malay Peninsula. Tun Saban and Nakhoda Kassim then travelled to Kampar, where Mahmud Shah agreed to their request and named his son the first Sultan of Perak.