The Manchu Restoration of July 1917 was an attempt to restore monarchy in China by General Zhang Xun, whose army seized Beijing and briefly reinstalled the last emperor of Qing Dynasty, Puyi, to the throne. The restoration lasted only a few days, from July 1 to July 12, and was quickly reversed by republican troops.
The confrontation between President Li Yuanhong and Premier Duan Qirui about whether to join the Allies in World War I and declare war on Germany led to political unrest in the capital Beijing in the spring of 1917.
The military governors left Beijing after Duan Qirui's dismissal as Premier. They gathered in Tianjin, calling on the troops from the provinces to rebel against Li and take the capital, despite the opposition of the navy and the southern provinces. In response, on June 7, 1917, Li requested that General Zhang Xun mediate. General Zhang demanded that parliament be dissolved, which Li considered unconstitutional.
On the morning of July 1, 1917, the royalist general Zhang Xun took advantage of the unrest and entered the capital, proclaiming the restoration of Puyi at 4 am with a small entourage and reviving the Qing monarchy which had been abandoned earlier on February 12, 1912. The capital police soon submitted to the new government. General Xu later published an edict of restoration that falsified the approval of the president of the republic, Li Yuanhong.
Over the next 48 hours, edicts were proclaimed in an attempt to shore up the restoration, to the astonishment of the general public. On July 3, Li fled the presidential palace with two of his aides and took refuge in the embassy district, first in French legation and later in the Japanese embassy.
Before taking refuge in the Japanese embassy, Li had taken certain measures, including leaving the presidential seal in the Presidential Palace, appointing Vice President Feng Guozhang as Acting President, and restoring Duan Qirui as Premier, in an attempt to enlist them in the defense of the republic.
Duan immediately took command of the republican troops stationed in nearby Tianjin. On July 5, 1917, his troops seized the Beijing-Tianjin railway 40 kilometers from the capital. On the same day, General Zhang left the capital to meet the republicans, his forces being further bolstered by Manchu reinforcements. Zhang was faced with overwhelming odds; almost all of the Northern Army was opposed to him and he was forced to withdraw after republican troops seized control of the two main railway lines to the capital.
On the ninth day of the Restoration, General Zhang resigned from his appointed positions, retaining only the command of his troops in the capital, which were surrounded by republican forces. The restored imperial court prepared an edict of abdication for Puyi, but fearful of Zhang's royalist forces, did not dare proclaim it. The imperial court began secret negotiations with republican forces to prevent an assault on the city, even asking the foreign legations to mediate between the parties. The uncertainty over the imperial court's own fate and that of General Zhang caused negotiations to fall apart. The republican generals announced a general assault on the positions of the monarchists on the morning of July 12.
The attack began the next day, with royalists troops entrenched on the wall of the Temple of Heaven. Shortly after the fighting began, negotiations resumed, resulting in the royalists giving up their positions. General Zhang, dismayed, fled to the legations quarter.  Once General Zhang had fled, the royalist troops called for a ceasefire, which was immediately granted.
President Li refused to return to his post, leaving it in the hands of Feng Guozhang. The departure of Li from the republican leadership allowed Duan to take charge of the government, and a month after the recapture of capital, on August 14, 1917, China declared war on Germany as Duan had originally wished, without opposition from Li. The withdrawal of Li led to the strengthening of military cliques in northern China and left the already-fractured central government in the hands of the Feng Zhili-Anhui Clique dominated by Duan. The weakening of the central government led to the further fragmentation of China into the warlord era and the rival government of Sun Yat-sen gaining popularity and traction in the south.