Raja Kassim, the son of Sultan Muhammad Syah with Tun Wati was appointed as the fifth ruler of Melaka when Sultan Abu Syahid passed away. He was known as Sultan Muzaffar Shah. When he was appointed the ruler of Melaka, he ordered his senior officials to put into effect the royal customs, traditions and prohibitions introduced by his late father. Sultan Muzaffar Shah married the daughter of Seri Amar Diraja who was the Prime Minister then and had a son by the name of Raja Abdullah.
When Bendahara Seri Wak Raja (I) passed away, the Sultan appointed Tun Perpatih Serdang, son of the late Bendahara Seri Wak Raja (I) as the Bendahara of Melaka and was called Seri Wak Raja (II). However, Seri Wak Raja (II) committed suicide by poisoning himself when he misunderstood that Sultan Muzaffar Shah was angry with him. The late Bendahara Seri Wak Raja (II) left a daughter, Tun Kudu and two sons, Tun Perak and Tun Perpatih Putih and Sultan Muzaffar Shah later married Tun Kudu. Tun Perak who was not holding any post in Melaka was sent by Sultan Muzaffar Shah to be the headman of Kelang. Seri Nara Diraja acted as Bendahara of Melaka.
A looming threat from Ayuthia, the capital of Siam, became a reality in the form of an attack on Melaka by land in 1446. Tun Perak brought men from Kelang to help Melaka repel the Siamese. His good sense and leadership qualities attracted the attention of the Sultan, whose desire to see Melaka prosper made him appoint Tun Perak as the Bendahara.
Tun Perak?s rise to political prominence created a tension between him and Tun Ali. Since his two favourite leaders were at odds, which could caused a split among the people, Sultan Muzaffar Shah had a discussion with Tun Ali, who was an elderly widower. Tun Ali agreed to keep on the condition that he was allowed to marry Tun Kudu, the Sultan?s consort. Sultan Muzaffar Syah agreed to divorce his consort in the interest of political stability and Tun Kudu also agreed, for the peace of the nation, to marry Tun Ali. The sacrifices of Tun Kudu and Sultan Muzaffar Syah were not in vain. Tun Ali and Tun Perak became good friends and supported each other in working for the development of Melaka. It was not long before Tun Ali himself asked the Sultan to appoint Tun Perak as Bendahara. The Sultan then appointed Tun Perak as the Bendahara with the title ?Paduka Raja? around the year 1456.
The Government of Siam, with its capital at Ayuthia, wanted to conquer Melaka atlhough an earlier attack by land had ended in defeat for the Siamese. In 1456, during the reign of King Boromo Trilokanat, they planned a naval attack on Melaka. The government of Melaka, when it learned of Ayuthai?s intentions, put its naval forces in readiness and decided to repel the attack near Batu Pahat. The forces were commanded by Tun Perak and assisted by Tun Hamzah, a warrior by the nickname Datuk Bongkok. A fierce fight broke out between the two sides and this was the first engagement Melaka had faced. Nevertheless, they were more superior in skill and knowledge and their ships succeeded in driving off the Siamese, pursuing them to Singapore and forcing them to return home. Melaka?s victory in this battle gave it new confidence to devise strategies for extending its influence throughout the Archipelago. The defeat of Siam brought political stability to Melaka and enhanced its reputation in South East Asia. However, Sultan Muzaffar Syah died after the Siamese?s attack in 1456.