In March 1870, Raja Ismail with help from Tengku Kudin besieged Klang, defeating Raja Mahadi, who retreated to Kuala Selangor, which he captured from Raja Musa with help from Raja Hitam. Syed Mashhor, who served under Tengku Kudin, was sent to Kuala Selangor to help Raja Musa but switched sides after learning that his brother had been killed by a son of the Sultan. Raja Mahadi allied with Chinese in Kanching who were enemies of Yap, then attacked Kuala Lumpur in 1870 with the Malay forces led by Syed Mashhor, and again in 1871, but both attacks were unsuccessful.