It was built in the 17th year of the Hongzhi era of the Ming Dynasty (1504), rebuilt in the 57th year of the Qianlong era of the Qing Dynasty (1792), and rebuilt again in 1996. Fighting in war requires war horses. The god of horses was worshipped to pray for the health of war horses, prosperity and combat power. There were official sacrifices to the horse gods in Sui, Tang, Song and Liao dynasties. Emperor Zhu Yuanzhang of the Ming Dynasty commissioned the sacrifice of horse gods and goddesses, and specially appointed the temple in Nanjing to preside over.