In December 1911, Sun was elected as provisional president.
On 1 January 1912, the Republic of China was founded at Nanjing.
To turn the tide, the Qing government summoned Yuan Shikai, who was dismissed earlier on, to lead the Beiyang Army.
In an effort to prevent a civil war, Sun began negotiations with Yuan.
In return for Yuan's support for the republic to overthrow the Qing Dynasty, Sun agreed to step down and pass his residency to Yuan.