Malaccan sultan, Mahmud Shah, fled to Johore, where he established the new Johore Sultanate. Singapura became part of this sultanate. In 1613, however, the Portuguese reportedly burning down a trading outpost at the mouth of the river and Singapura passed into history. The territory controlled by the Johore Riau Lingga Pahang Sultanate in the late eighteenth century still included Singapore as part of its territory. The sultanate had become increasingly weakened by a division into a Malay faction, which controlled the peninsula and Singapore and a Bugis faction which controlled the Riau Archipelago and Sumatra. When Sultan Mahmud Riayat Shah III died in 1811, the Bugis had proclaimed the younger of his two sons, Abdul Rahman, as sultan instead of the elder son, Tengku Long. While the sultan was the nominal ruler of his domain, senior officials actually governed the sultanate. In control of Singapore and the neighbouring islands was Temenggong Abdul Rahman, Tengku Long's father-in-law. In 1818, he and some of his followers left Riau for Singapore shortly after the Dutch signed a treaty with the Sultan Abdul Rahman, allowing the Dutch to station a garrison at Riau. In 1819, Tengku Long signed a treaty with the British led by Sir Stamford Raffles. In exchange for British protection and recognising him as Sultan of Johor, Tengku Long agreed to allow the British to establish a trading post in Singapore. Proclaimed as Sultan Hussein Shah, he became the Sultan of Johore. Hussein Shah's claim to be Sultan of Johor and Singapore was by all accounts not recognised by the Malay rulers and was only a nominal title. Sultan Hussein on his part, did not pursue any active claim to his sovereignty rights over Johor, spent much of his time at his residence in Istana Kampong Glam until he moved to Malacca in 1834. In 1835, Sultan Hussein Shah died and was succeeded by his eldest son, Tengku Ali. In 1855, due to his debts caused by his extravagant lifestyle, Sultan Ali formally ceded his sovereignty rights of Johor to Temenggong Daeng Ibrahim with the exception of the Kesang territory in Muar, plus an annual stipend for his family. Thus, Temenggong Daeng Ibrahim was made the de facto Maharajah of Johor until his death in 1862. He was succeed by his son Abu Bakar, who eventually went on to became the Sultan of modern Johor in 1886. After Sultan Ali's death