Ma Gong Temple was originally built during the Ming dynasty. The deity enshrined here was said to be the god worshipped by the Horse Soldier Camp. Ma Gong Temple used to be called Ma Wang (Horse King) Temple which was considered a place of Six Wholesomes. It was founded by one of the four subordinates of the Sacred Prince, Developer of Zhangzhou, Fu Shun General Ma Ren (A.K.A. Ma Gongyi) in the Zheng's ruling period in Ming dynasty.