Legends of battle and mediation between gods and ghosts are unique in the richly diverse folktales in Taiwan. In the legends, two sides often end up in fierce conflict. When neither side can prevail, a higher spiritual power will intervene. In addition to reflecting contemporary ideas about conflict and the restoration of harmony, the legends also reflect local history. The conflicts in the legends recall struggles by different ethnic groups in local settlements for limited resources and economic benefits as well as the complex alliances and competitive relations between temples, which played an important role in local identity formation and maintenance. In summary, this research treats the legends as allegories of the complex interactive relationships between gods, humans, and settlements.