When the Selangor Civil War broke out, Kapitan Cina of Kuala Lumpur Yap Ah Loy was faced with internecine fighting among dissident Chinese groups as well as attacks from Malay factions. The two largest Chinese gangs, the Hai San (based in Kuala Lumpur) and the Ghee Hin (based in the Kanching (present day Templer Park) and Rawang area), had engaged in fighting to gain control of tin production in the town. The Chinese factions would eventually joined opposing sides in the civil war, with the Ghee Hin siding with Raja Mahdi, and the Hai San with Yap Ah Loy siding with Tengku Kudin.