In the 1650s, Burma became entangled in the dynastic changes in China. In 1651, Ming armies fleeing from the Qing forces entered Kengyun , which had paid tribute to both China and Burma. King Pindale sent five regiments to the front in October 1651. But the armies were driven back by the Ming in December 1651. Pindale would not contest again. In 1658, Zhu Youlang, one of the sons of the last Ming emperor, and his 700 followers were given permission to stay at Sagaing. In early 1659, other fleeing Ming armies entered the Shan states, and occupied Nyaungshwe and Mone with the intention to set up a kingdom for their emperor. For the next two years, the Ming forces proved a menace to Upper Burma. Not only Pindale could not drive out the Ming but it was the Ming that continually threatened the Burmese capital itself, and ransacked Upper Burma districts. On 4 June 1661, Pye Min overthrew his ineffectual brother, and took over the command. He finally drove out the Ming by November 1661. The problems were not yet over for the Burmese. On 21 December 1661, a Qing army of 20,000 under Gen. Wu Sangui showed up at Ava, demanding the surrender of the Ming emperor. The emperor was handed over on 15 January 1662, and the Qing forces left a week later.. How many months did it take for the emperor to surrender after Pye took over?