As an avowed Manichaean or arch-heretic he hardly could have obtained the influence he did. His admonitions against violence and harm to others were coupled with a call to a sharing of possessions, a primitive communism. We do not know how far Mazdak went, for his detractors even accused him of advocating the sharing of wives, which is unlikely. Just how or why the king adhered to, or favoured, Mazdakism is unknown, but most scholars have speculated that he was seeking to counter the power of the aristocracy. There seems little doubt that a desire to ameliorate the condition of the common people also played a role in the sympathies of Kavad for Mazdakite ideas. In any case the disorders consequent on Kavad's penchant for Mazdakism evoked a conspiracy of the nobility. We have mentioned rebellions among the Armenians and Arabs, and the refusal of the Byzantine emperor to send money for the defence of Darband; these things exacerbated the situation. Kavad was deposed and put in prison, and his brother Zamasp became ruler in 496.
Many stories are told about Kavad's escape from prison and flight to the court of the Hephthalite king, from where, after a few years, he returned to Iran with a Hephthalite army and Zamasp surrendered the throne to Kavad without a fight. This probably took place at the end of 498 or the beginning of 499, and it is probable that Zamasp was not killed as was usual in such cases. Kavad eliminated the chief nobles who had actively conspired against him, but in general he consolidated his position by clemency. The refusal of the Byzantine emperor to send money to Kavad, again ostensibly as a contribution to the defence of Darband, led to hostilities. Kavad needed money to pay his Hephthalite allies, and he opened hostilities in August 502 in the north-west part of his empire.
Theodosiopolis, present Erzerum, was captured by the Persians, and then Kavad moved to the south and laid siege to Amida. After a spirited defence it fell in January 503. The Byzantines reacted by sending several armies to the east and the war moved back and forth with no major victory for either side. In 503 Kavad had to break off operations to meet an invasion of his territory in Transcaucasia. In 504 the Byzantines had the advantage although they could not retake Amida. In 506 peace was made whereby Kavad received some money from Byzantium as a compensation for the Byzantine fortification of the town of Dara contrary to a longestablished agreement between the two empires, but Kavad gave up Amida and other conquests. The treaty was to last seven years but in fact was extended.