Perlis was part of Kedah Sultanate from at least the mid-16th century. Its boundaries were first demarcated in 1770, when Sultan, Muhammad Jiwa II of Kedah, presented the territory to his younger son, Tunku Dhiauddin. When Tunku Dhiauddin ascended to the Kedahan throne, he in turn presented Arau to his son-in-law Syed Harun Jamalullail, who assumed the title of Penghulu ('chief') of Arau. In 1825, Syed Harun died and his son Syed Hussein succeeded him as Penghulu of Arau. He assumed office during a period of turmoil when Kedah – including Perlis – was invaded by Siam, and later administered by the Siamese governor of Ligor. Following the death of Governor of Ligor in 1839, Perlis was detached from Kedah and designated as a separate Siamese tributary. A Malay chieftain was appointed Chiom ('chief') of Perlis while Syed Hussein was made his deputy. Within four months however, the Chiom of Perlis died and in 1841, Syed Hussein travelled to Bangkok and secured the recognition from Rama III to install him as the Phya ('King') of Perlis. His accession marked the founding of Jamalullail dynasty which continues to rule Perlis in the present day.