Buddhist and Daoist organizations were closely connected to local irrigation systems in Shanxi during the thirteenth and fourteenth centuries under the Mongol Yuan dynasty. The privileged social status, organizational abilities and control over economic resources enjoyed by Buddhist and Daoist clergy, coupled with their efforts to rebuild local society after wars and natural disasters , served as the basis for their authority in local irrigation systems. Abbots of Buddhist and Daoist monasteries frequently served as managers of irrigation associations. They organized local people to construct irrigation projects and took charge of regular water distribution and water management. In some cases they set up regulatory systems that favored their own monastic communities. Buddhist and Daoist communities also influenced the local cults of water gods associated with irrigation systems, through their performance of sacrifices to water deities, contributions to the rebuilding and management of temples, and shaping of representations of water gods. The presence of Buddhist and Daoist communities in local irrigation systems weakened in the late Yuan and early Ming periods, when these clergy gradually lost the privileged status they had enjoyed under Mongol rule. Meanwhile, villagers sought to take over the clergy's monastic property and transformed Buddhist and Daoist institutions into village temples. The sacred space for worshipping water gods gradually separated from Buddhist and Daoist monasteries.