Constant Mongol raids, economic difficulties, and the emperor's illness led to a massive popular uprising in the north-east in 1277. The rebel army, led by the swineherd Ivaylo, defeated the Mongols twice, greatly boosting Ivaylo's popularity. Ivaylo then turned on and defeated the regular army under the command of Constantine Tikh. He personally killed the emperor, claiming the latter did nothing to defend his honour. Fearing a revolt in Byzantium, and willing to exploit the situation, the emperor Michael VIII sent an army led by Ivan Asen III, a Bulgarian pretender to the throne, but the rebels reached Tarnovo first. Constantine Tikh's widow Maria married Ivaylo and he was proclaimed emperor. After the Byzantines failed, Michael VIII turned to the Mongols, who invaded Dobrudzha and defeated Ivaylo's army, forcing him to retreat to Drastar, where he withstood a three-month siege. After his defeat, Ivaylo was betrayed by the Bulgarian nobility, who opened the gates of Tarnovo to Ivan Asen III. In early 1279, Ivaylo broke off the siege at Drastar and besieged the capital. The Byzantines sent a 10,000-strong army to relieve Ivan Asen III, but suffered defeat by Ivaylo at the battle of Devina. Another army of 5,000 had a similar fate, forcing Ivan Asen III to flee. Ivaylo's situation did not improve, however—after two years of constant warfare his support was diminished, the Mongols were not decisively defeated, and the nobility remained hostile. By the end of 1280, Ivaylo sought refuge with his former enemies the Mongols, who under Byzantine influence killed him. The nobility chose the powerful noble and ruler of Cherven, George I Terter, as emperor. He reigned for twelve years, bringing even stronger Mongol influence and the loss of most of the remaining lands in Thrace to the Byzantines. This period of instability and uncertainty continued until 1300, when for a few months the Mongol Chaka ruled in Tarnovo.