The armies of the Manchu emperors first entered Tibet in response to a request for help when Tibet was invaded by the Dzungar Mongols in 1717. After the defeat of a first expeditionary force in the Battle of the Salween River in 1718 the Chinese expedition in 1720 was successful in restoring the Dalai Lama to power in Lhasa. Troops were withdrawn in 1723 leaving a civilian Chinese adviser in Lhasa. When civil war broke out in 1728 there were appeals from both sides for help from China and an army was once again dispatched to Lhasa. It was decided to appoint two "ambans", civilian Chinese advisers to the Tibetan government, who would be guarded by a small military force. When there was unrest in 1750 an army was again dispatched and the ambans given more power. However, the ambans, isolated from imperial power centers, soon fell under the control of the local government. There was a long period of peace, and neglect by the Chinese of Tibetan affairs, but in 1792 an invasion by Gurkas of Nepal resulted in an appeal for aid and a successful Chinese response. In 1893 the Chinese imposed reforms in Tibet which resulted in closing of its borders to foreign travelers, but despite intentions to strengthen the role of the ambens, a long period of Chinese neglect followed which continued throughout the 19th century during which Tibet was "closed" but effectively on its own.