The Anastasian War ended the longest period of peace the two powers ever enjoyed. War broke out when the Persian King Kavadh I attempted to gain financial support by force from the Byzantine Emperor Anastasius I; the emperor refused to provide it and the Persian king tried to take it by force.* Greatrex–Lieu (2002), II, 62</ref> In 502 AD, he quickly captured the unprepared city of Theodosiopolis* Greatrex–Lieu (2002), II, 62</ref> and besieged the fortress-city of Amida through the autumn and winter (502–503). The siege of the fortress-city proved to be far more difficult than Kavadh expected; the defenders repelled the Persian assaults for three months before they were beaten.* Greatrex–Lieu (2002), II, 63</ref> In 503, the Romans attempted an ultimately unsuccessful siege of the Persian-held Amida while Kavadh invaded Osroene and laid siege to Edessa with the same results. Finally in 504, the Romans gained control through the renewed investment of Amida, which led to the fall of the city. That year an armistice was reached as a result of an invasion of Armenia by the Huns from the Caucasus. Although the two powers negotiated, it was not until November 506 that a treaty was agreed to.* Greatrex–Lieu (2002), II, 77</ref> In 505, Anastasius ordered the building of a great fortified city at Dara. At the same time, the dilapidated fortifications were also upgraded at Edessa, Batnae and Amida.* Greatrex–Lieu (2002), II, 74</ref> Although no further large-scale conflict took place during Anastasius' reign, tensions continued, especially while work proceeded at Dara. This was because the construction of new fortifications in the border zone by either empire had been prohibited by a treaty concluded some decades earlier. Anastasius pursued the project despite Persian objections, and the walls were completed by 507–508.* Greatrex–Lieu (2002), II, 77</ref>