The territory of present-day Soviet Azerbaijan roughly corresponds to the ancient Caucasian Albania. Twenty six languages were spoken in Albania and it had its own kings.
Caucasian Albania became Christianized at approximately the same time as was Armenia; Movses Dasxuranc'i places this event in the reign of King Urnayr in the mid-4th century CE, and states that St. Gregory, founder of the Armenian national church, was responsible for the monarch's baptism. The Monophysite Albanian church remained separate from the Armenian one till the end of the 7th century CE, when the two were united under stimulus from the Arabs. Until well into medieval Islamic times, Muslims must have been only a minority in Arran; Moqaddasi, p. 376, writing towards the end of the 4th/10th century, describes the Christians as still a majority in the towns of Qabala and Šabaran (near Quba). In the Byzantino-Sasanian wars, the Albanian kings sometimes had to supply contingents for the imperial Iranian army, and Urnayr participated with Shapur II in the siege of Amed in 359, but more generally they combined with their fellow-Christian Armenian princes in resisting Persian expansion into Transcaucasia and Armenia, at times even paying tribute to the Byzantines.