The Yuan , Ming , and Qing dynasties all made Beijing their capitals . When the Qing dynasty lost power and the Republic of China was set up , the new Republic moved its capital from Beijing to Nanjing .
After high-ranking Qing official Yuan Shikai forced the abdication of the Qing emperor in Beijing and ensured the success of the revolution , the revolutionaries in Nanjing accepted that Yuan should be the president of the new Republic of China and the capital remains at Beijing .