Yap Ah Loy initially stayed uncommitted in the Klang War, choosing to deal with whoever that was in power. After Raja Madhi took power in Klang, Raja Madhi had in fact organised a ceremony to formally invest Yap into the office of Kapitan in 1869. Later Tengku Kudin captured Klang, and Yap recognized the authority of Tengku Kudin after meeting him by chance in Langat, thereby making him an enemy of Raja Madhi. Chong Chong joined Syed Mashhor to attack Kuala Lumpur twice, but were unsuccessful both times.