(File photo)
The wall is directly across from a narrow passageway-only one person can fit at a time-leading to the 700-square-km Zizhulin Temple adjacent to caverns.
A drum and a bell tower sprout from the holy site, which was also constructed to withstand incursions via walls, gates and its own tunnel network.
The courtyards and surrounding buildings are festooned with elaborate woodcarvings, and images and statues hailing from Buddhism, Taoism and Confucianism.
"The harmonious coexistence of different religions in the temple shows its long history. Different dynasties promoted different religions," tour guide Jia Heping explains.
"Feng shui masters praise the design. Its position halfway up the mountain slope facing a steam on one side and a mountain spring on another is particularly auspicious."
Monks continue to run the temple, the crumbling village's only recently reinforced structure.
Villagers say the temple's Buddha is particularly effective and has protected the compound for generations.
That said, the caves among which the temple was built did the same for Taiyuan-and themselves.