According to the 9th-century Chronicle of Alfonso III, Erwig was the son of Ardabast, who had journeyed from the Byzantine Empire to Hispania during the time of Chindasuinth, and married Chindasuinth's niece Goda. Ardabast, was probably an Armenian or Persian Christian exile in Constantinople or in Byzantine Africa. In Hispania he was made a count. 17th-century Spanish genealogist Luis de Salazar y Castro gave Ardabast's father as Athanagild, the son of Saint Hermenegild and Ingund, and his mother as Flavia Juliana, a daughter of Peter Augustus and niece of the Emperor Maurice. This imperial connection is disputed by Christian Settipani, who says that the only source for Athanagild's marriage to Flavia Julia is José Pellicer, who he claims to be a forger.
Succession
After his predecessor Wamba had taken the monastic habit while on the verge of death, he was forced to retire from the kingship on 14 October 680, even though he recovered, and enter a monastery. He appointed Erwig his successor and the latter was anointed in Toledo on 31 October 680. Later, 9th-century legends attributed to Erwig the poisoning of the king, who was made a penitent by his supporters while Erwig's supporters raised him to the throne. The bishops of the Twelfth Council of Toledo, which Erwig opened on 9 January 681, confirmed that the documents of abdication and confirmation of Erwig from Wamba were authentic and contained his own signature. Nonetheless, some historians have seen in the rapidity of Erwig's unction after the king had received the penitential sacrament evidence for a pre-planned palace coup. Erwig began his reign in a climate of uneasiness concerning the way in which he reached the throne. Probably feeling insecure himself, the nobles and bishops took advantage. Erwig restored to favour those who had been out of it in the time of Wamba. After the Twelfth Council, the Thirteenth and Fourteenth followed in quick succession. The councils confirmed Erwig's legitimacy for a second time and wrote many laws to protect the life and rule of the king and his family, including that of his queen, Liuvigoto. After falling seriously ill, Erwig proclaimed his son-in-law Ergica, the husband of his daughter Cixilo, as his heir on 14 November 687 and retired to a monastery as a penitent the next day, after giving leave to his court to return to Toledo with Egica for the anointing and crowning.
Legislation
Erwig issued 28 laws condemning Jews with the support of the Twelfth Council. He himself stated to the council his desire to return to the legislation of the reign of Sisebut, though he was a little more lenient, dispensing with the death penalty. These laws were part of a revised and expanded version of the Liber Iudiciorum which is attached to Erwig's name. All of the laws, which dealt with Jews, have been attributed to the influence of Julian of Toledo, the fanatically anti-Jewish archbishop of Toledo. When the Ervigian code was promulgated in November 681, Erwig had added six more of his own new laws and three laws of Wamba, as well as revised eighty laws of Recceswinth. There is no evidence, however, that the Ervigian code "superseded" the Recceswinthian and manuscripts of both continued to be produced and sold. Declaring them a plague on the kingdom, he called for the total removal of the Jews from the kingdom. Such a decree had been issued by Erwig's predecessor Wamba and much as that one Erwig's also failed. So in 681 he issued another decree, this time requiring that all Jews become Christians or leave the kingdom. Jews were officially discriminated against from henceforth as the monarchy attempted to restrict Jewish commercial activities.