In January 1812, Mahmud Shah III died leaving two sons Tengku Hussein and Tengku Abdul Rahman. The Bugis Yamtuan Muda supported the claim of Abdul Rahman to the Sultanate, and succeeded in having him proclaimed ruler at Mahmud's grave-side.[4]