exchange for gold. The Persian provinces also suffered severely and a peace was concluded in 506. Anastasius afterward built the strong fortress of Daras, which was named Anastasiopolis, to hold the Persians at Nisibis in check. The Balkan provinces were denuded of troops, however, and were devastated by invasions of Slavs and Bulgars; to protect Constantinople and its vicinity against them, the emperor built the Anastasian Wall, extending from the Propontis to the Black Sea. He converted his home city, Dyrrachium, into one of the most fortified cities on the Adriatic with the construction of Durrës Castle. Domestic and ecclesiastical policies The Emperor was a convinced Miaphysite. However, his ecclesiastical policy was moderate. He endeavoured to maintain the principle of the Henotikon of Zeno and the peace of the church. Yet, in 512, perhaps emboldened after his military success against the Persians, Anastasius I deposed the Patriarch of Chalcedon and replaced him with a Monophysite. This violated his agreement with the Patriarch of Constantinople and precipitated riots in Chalcedon. The following year the general Vitalian started a rebellion, quickly defeating an imperial army and marching on Constantinople. With the army closing in, Anastasius gave Vitalian the title of Commander of the Army of Thrace and began communicating with the Pope regarding a potential end to the Acacian schism. Two years later, General Marinus attacked Vitalian and forced him and his troops to the northern part of Thrace. Following the conclusion of this conflict, Anastasius had undisputed control of the Empire until his death in 518. Successor The Anonymous Valesianus gives a (most likely fictional) account of Anastasius attempting to predict his successor: Anastasius did not know which of his three nephews would succeed him, so he put a message under one of three couches and had his nephews take seats in the room. He believed that the nephew who sat on the couch with the message would be his heir. However, two of his nephews sat on the same couch, and the one with the concealed message remained empty. After putting the matter to God in prayer, he determined that the first person to enter his room the next morning would be the next emperor, and that person turned out to be Justin, the chief of his guards. Anastasius died childless in Constantinople on 9 July 518. He was 90 and a half years old according to the later chronicles