The 1868 Burlingame Treaty encouraged Chinese immigration to meet labor needs, especially on Western railroads. However, only a few years later, the need for foreign labor declined as more Americans moved West. As gold mining became less fruitful, hostility toward Asian competition increased. Violence against Asians was prevalent, leading to the largest lynching in American history, the Chinese Massacre of 1871. Consequently, a barrage of legislation was passed to restrict Asian immigration, a group that was now characterized as the "Yellow Peril". The enforcement of the legislation required a more concrete formation of what the Asian race entailed, and the courts were used to construct it.