[2][3] According to Ibn al- Nadim, it was the stronghold of Javidhan and Babak Khorramdin, the leaders of the Khurramites in Iranian Azerbaijan who fought the Islamic caliphate of Abbassids.
The castle is nearly impossible to capture, due to its elevated location in the mountains and being protected by ice and snow.
During one of the clashes, in probably 816, Abu Imran was defeated and killed, whilst Javidhan was mortally wounded, dying three days later.
Babak's victories over Arab generals were associated with his possession of Badd fort and the inaccessible mountain stronghold, according to Arab historians who mentioned that his influence also extended to the territories of today’s Azerbaijan Republic- "southward to near Ardabīl and Marand, eastward to the Caspian Sea and the Shamakhi district and Shervan, northward to the Mughan (Moḡān) steppe and the Aras river bank, westward to the districts of Julfa, Nakhchivan, and Marand".
Afshin had additional forces from the Caliphate under the Arab magnate Abū Dolaf and settled in a camp six miles away from Badd fortress.