Raja Kassim, son of Sultan Muhammad Shah and Tun Wati, was installed as the fifth ruler of Malaccaafter the death of his half-brother Sultan Muhammad Shah. His uncle, Tun Ali was an influential Tamil Muslim leader who allegedly conspired to assassinate the fourth sultan of Malacca, Raja Sri Parameswara Dewa Shah so that his nephew could ascend the throne. After his installation as ruler of Malacca, Raja Kassim titled himself as Sultan Muzaffar Shah. Sultan Muzaffar Shah ordered his senior officers to perform all the customs, traditions and prohibitions introduced by his late father. Sultan Muzaffar Shah married the daughter of the Bendahara and had a son named Raja Abdullah.
When Bendahara Seri Wak Raja I died, the Sultan appointed Tun Perpatih Sedang, the son of the late Bendahara to replace him and gave him the title Seri Melaka Wak King. However, Sri Wak Raja II took his own life by drinking poison when he mistook the Sultan for being displeased with him. He left behind a daughter, Tun Kudu, and two sons, Tun Perak and Tun Perpatih Putih. According to tradition, either Tun Perak should take over his later father's place. However, the Sultan made his own uncle, Tun Ali the new Bendahara out of gratitude for helping him ascend the throne. Sultan Muzaffar Shah later married Tun Kudu. Meanwhile, Tun Perak, was sent away to Klang and made chieftain there to avoid any political turmoil. In 1456, during the reign of King Boromo Trilokanat, Siam made plans to attack Malacca by sea. When the Malacca government learned about this plan, it prepared its naval and decided to attack the Siamese in Batu Pahat. The forces were led by Tun Perak and assisted by Tun Hamzah, a warrior called Datuk Bongkok. A fierce battle took place between the two sides, and this became the first military battle of Malacca. However, Malacca had the advantage in terms of skills and knowledge. They successfully drove the Siamese forces to Singapore and forced them back. Malacca's victory in this war has injected new vigor in the strategy to expand its influence in the Malay Archipelago. The victory over Siam also led to political stability and strengthened the reputation of Malacca in Southeast Asia. Tun Perak's rise in the political arena created tension between him and Tun Ali. Seeing that the feud between these two powerful leaders can lead to disunity among the people of Malacca, Muzaffar decided to level with Tun Ali, who was a middle-aged widower at the time. Tun Ali agreed to step down as Prime Minister provided he be allowed to marry Tun Kudu, who was one of the Sultan's wives. Sultan Muzaffar Shah consented to divorce his wife for the sake of political stability and Tun Kudu also agreed to marry Tun Ali for the well being of the country. The sacrifice of Sultan Muzaffar Shah and Tun Kudu was not in vain. Tun Ali and Tun Perak became close friends and even worked together for the development of Malacca. Soon, Tun Ali himself supported the Sultan's decision to appoint Tun Perak as Prime Minister. Thus, Sultan has appointed Tun Perak as the new bendahara and titled him Paduka Raja around 1456