Ancient Armenian literary sources almost always give the name of the ancient city of Dvin as Dwin or Duin. Later authors favored the Dvin appellation, which is the most common form given in scholarly literature. The word is of Middle Iranian origin, and means hill.
The ancient city of Dvin was built by Khosrov III of Armenia in 335 on a site of an ancient settlement and fortress from the 3rd millennium BC. Since then, the city had been used as the primary residence of the Armenian Kings of the Arsacid dynasty. Dvin boasted a population of about 100,000 citizens in various professions, including arts and crafts, trade, fishing, etc.
After the fall of the Armenian Kingdom in 428, Dvin became the residence of Sassanid appointed marzpans (governors), Byzantine kouropalates and later Umayyad- and Abbasid-appointed ostikans (governors), all of whom were of senior nakharar stock. Under Arsacid rule, Dvin prospered as one of the most populous and wealthiest cities east of Constantinople. Its prosperity continued even after the partition of Armenia between Romans and Sassanid Persians, when it became the provincial capital of Persian Armenia, and eventually it became a target during the height of the Muslim conquests. According to Sebeos and Catholicos John V the Historian, Dvin was captured in 640 during the reign of Constans II and Catholicos Ezra. During the Arab conquest of Armenia, Dvin was captured and pillaged in 640, in the first raids. On January 6, 642 the Arabs stormed and took the city, slaughtered 12,000 of its inhabitants and carried 35,000 into slavery. Dvin became the center of the province of Arminiya, the Arabs called the city Dabil.
Although Armenia was a battleground between Arabs and Byzantine forces for the next two centuries, in the 9th century it still flourished. Frequent earthquakes and continued warfare led to the decline of the city from the beginning of the 10th century. During a major earthquake in 893, the city was destroyed, along with most of its 70,000 inhabitants.
Following a devastating Daylamite raid in 1021, which sacked the city, Dvin was captured by the Shaddadids of Ganja, and ruled by Abu'l-Aswar Shavur ibn Fadl, who successfully defended it against three Byzantine attacks in the latter half of the 1040s.