After Sultan Mukaddam Shah died in 1619 in the Aceh Sultanate, a noble of Perak who had the title of Maharaja Lela went to Johor. At that time Perak was still under the control of Aceh. So all decisions related to Perak had to get approval from the Sultan of Aceh. Even so, Maharaja Lela ignored the Sultan of Aceh and proceeded to Johor to obtain a descendent of the Sultan of Perak in order to appoint the new Sultan of Perak. Maharaja Lela brought Raja Mansur back to Perak where he was installed as the 7th Sultan of Perak with the title of Sultan Mansur Shah II. Mansur Shah II resided in Semat. According to the Sejarah Raja Perak, when Sultan Mansur Shah II ruled Perak, it is said that he went back and forth to Johor because he had another wife there. In 1627 after ruling Perak for 8 years, he died while in the Johor Sultanate and was buried there.[1] However, there is a discrepancy in the information available regarding this when compared to the known history of Perak.[2]
According to the known history of Perak, in 1627, Sultan Iskandar Muda of Aceh sent an army to Perak to remove Sultan Mansur Shah II from the throne. This was because Perak was still under the power of Aceh at that time and Sultan Mansur Shah II had ascended to the throne of Perak without the consent of the government of Aceh. Raja Bongsu or Raja Yusuf (Sultan Mahmud Shah I) who was the younger brother of Sultan Mukaddam Shah was appointed by the nobles of Aceh to replace Sultan Mansur Shah II.[2]