The gradual integration of Yunnan into the empire in the Ming and Qing was in large part the result of substantial immigration by Han into former border areas. Increasing competition over local resources led to frequent conflict between Han immigrants and indigenous peoples. Some Han immigrant elites played a role in organizing the indigenous Luohei in religious movements that challenged the Qing government. This development was linked to changing Qing policies on the frontier. In the early nineteenth century, the Qing saw the Luohei as a buffer between Chinese territory and the domains of Burmese chiefs, and sought to drive any rebellious Luohei further into Burma. In the later nineteenth century, as Burma came increasingly under British colonial control, the Luohei came to be seen as an ethnic group who inhabited a zone that spanned the fixed territorial borders of a modern state. In the process of constructing the border, the social institutions and historical memory of the Luohei also underwent changes, leading to a higher degree of ethnic identification. Eventually this identity was confirmed by the PRC's ethnic minority system, which recognized the Luohei, now known as the Lahu, as a national minority. The strengthening of Lahu ethnic identity was thus the product of immigrant elites and the state, as well as the Lahu themselves.