When Mahmud Shah II died in 1699, Bendahara Tun Abdul Jalil became Sultan of Johor-Pahang-Riau-Lingga and assumed the title Sultan Abdul Jalil Shah IV.
By the early 19th century, the Johor-Pahang-Riau-Lingga empire had begun to break up.