The Bulgarians conquered the city in 867, and the name "Ochrid" (or Achrida) first appeared in 879. Between 990 and 1015 Ochrid was the capital and stronghold of the Bulgarian Empire (ruled by Tsar Samuel), which—although Orthodox since 864—was in conflict with Constantinople. After the Byzantine conquest of the city in 1018, the Bulgarian Patriarchate was downgraded to a semiautonomous Archbishopric, but still under the authority of Constantinople. After 1018 the archbishops were almost invariably Greek, including during the period of Ottoman subjugation. Blessed Theophylact is the most famous of these archbishops, because of his Scriptural commentaries and other writings.
As an episcopal city, Ohrid was an important cultural center. According to tradition, the city of Ochrid once had within its boundaries 365 churches and chapels—one for every day of the year. Many of its surviving churches were built by the Byzantines and the Bulgarians: others date to the time of Serbian rule during the late Middle Ages. They include the Cathedral of St. Sophia, in which Blessed Theophylact served. It is believed to have been built or rebuilt between the years 1035-1056 on the grounds of an earlier Christian basilica. The interior of this cathedral has been preserved with frescoes from the 11th, 12th, and 13th centuries, representing some of the most beautiful and influential achievements of Byzantine iconography of that time.