Chinese nationalism emerged in the late Qing dynasty (1636–1912) in response to the humiliating defeat in the First Sino-Japanese War and the invasion and pillaging of Beijing by Eight-Nation Alliance. In both cases, the aftermath forced China to pay financial reparations and grant special privileges to foreigners. The nationwide image of China as a superior Celestial Empire at the center of the universe was shattered, and last-minute efforts to modernize and strengthen the old system were unsuccessful. These last-minute efforts were best exemplified by Liang Qichao, a late Qing reformer who failed to reform the Qing government in 1896 and was later expelled to Japan, where he began work on his ideas of Chinese nationalism.