During the second Iconoclasm, which began in 814, his family suffered persecution since his father, Sergios, was a prominent iconophile. Sergios's family returned to favor only after the restoration of the icons in 842. Certain scholars assert that Photios was, at least in part, of Armenian descent while other scholars merely refer to him as a "Greek Byzantine". Byzantine writers also report that Emperor Michael III (r. 842–867) once angrily called Photios "Khazar-faced", but whether this was a generic insult or a reference to his ethnicity is unclear. Although Photios had an excellent education, we have no information about how he received this education. The famous library he possessed attests to his enormous erudition (theology, history, grammar, philosophy, law, the natural sciences, and medicine). Most scholars believe that he never taught at Magnaura or at any other university; Vasileios N. Tatakes asserts that, even while he was patriarch, Photios taught "young students passionately eager for knowledge" at his home, which "was a center of learning". He was a friend of the renowned Byzantine scholar and teacher Leo the Mathematician. Photios says that, when he was young, he had an inclination for the monastic life, but instead he started a secular career. The way to public life was probably opened for him by (according to one account) the marriage of his brother Sergios to Irene, a sister of Empress Theodora, who upon the death of her husband Emperor Theophilos (r. 829–842) in 842, had assumed the regency of the Byzantine Empire. Photios became a captain of the guard ("prōtospatharios") and subsequently chief imperial secretary ("protasēkrētis"). At an uncertain date, Photios participated in an embassy to the Abbasids of Baghdad. Photios's ecclesiastical career took off spectacularly after "Caesar" Bardas and his nephew, the youthful Emperor Michael, put an end to the administration of the regent Theodora and the logothete of the drome Theoktistos in 856. In 858, Bardas found himself opposed by the then Patriarch Ignatios, who refused to admit him into Hagia Sophia, since it was believed that he was having an affair with his widowed daughter-in-law. In response, Bardas and Michael engineered Ignatios's confinement and removal on the charge of treason, thus leaving the patriarchal throne empty.