Upon the death of Sultan Bendahara Tun Ali (d. 1857), his two sons claimed his throne, which governed the Malay state of Pahang, whose easter coast borders the South China Sea. The oldest son, Tun Matahir (d.1863), was supported by Johore (Johor), a Malay sultanate to the south, and by the British, who were then opposing Siamese (Thai) domination of Malaya. Wan Ahmad (fl. 1860s), the other son, was helped by the Trengganu (Terengganu), a sultanate to the north, and by the Siamese. Both sides, whose outside supporters had ulterior motives, engaged chiefly in raids and ambushes, with occasional battles near fortifications. Siamese vessels sent to assist Wan Ahmad in 1862 were routed by a British warship. The war ceased soon after Tun Mutahir's death in 1863, and Wan Ahmad was recognized as the new sultan.