the Liaoning Wall and the Great Wall were equally useless in repelling invasion. Manchu invasions from the north began in c. 1600 CE and continued until 1644 CE when the Great Wall was opened to the invaders. China was again in turmoil at this time as a rebellion had been mounted against the Ming Dynasty. The Ming general Wu Sangui (1612-1678 CE), who had declared himself emperor, opened the Great Wall to the Manchus in a deal whereby they would help him defeat the rebels. Instead, the Manchus seized power, expelled the Ming Dynasty, and established the Qing Dynasty (1644-1912 CE). The victory of the Manchus over the Ming meant that the border of China was now some distance north of the Great Wall, and since it was no longer of any use in defense, it was neglected and fell into ruin until the rise of the Republic of China in 1912 CE, when it was found useful in controlling immigration and emigration.