However, Tay Son rebellions broke out in 1771 and quickly occupied a large area from Quy Nhon to Binh Thuan Province, thereby weakening the authority and power of the Nguyen lords.[10] While the war between Tây Sơn rebellion and Nguyễn lord was being fought, the Trịnh lords sent south a massive army and easily captured Phú Xuân in 1775.[11] After the capture of Phú Xuân, the Trịnh lords' general Hoang Ngu Phuc made a tactical alliance with Tay Son and withdrew almost all troops to Tonkin and left some troops in Phu Xuan.[12] In 1786, Tây Sơn rebellion defeated the Trịnh garrison and occupied Phú Xuân.[13] Under the reign of emperor Quang Trung, Phú Xuân became Tây Sơn dynasty capital.[14] In 1802, Nguyen Anh, a successor of the Nguyen lords, recaptured Phu Xuan and unified the country. Nguyen Anh rebuilt the citadel entirely and made it the Imperial City capital of all of Vietnam.[6]