Maslama’s attention had been diverted by Khazar attacks In 727–728 that reached deep into Azerbaijan.
Although Maslama had been able to drive them back and recover control of the Darial Pass, his 728 campaign across the Caucasus was difficult, bloody and indecisive.
Maslama's troops were reportedly engaged in up to thirty or forty days of constant fighting in miserable weather, and although he claimed victory in a battle over the Khazar khagan himself, the expedition had not achieved any results, and had come close to being defeated.
Certainly it had done little to stop Khazar attacks south of the Caucasus, which had resumed in 729.
Maslama was removed from office in the same year, and replaced by al-Jarrah ibn Abdallah.
He is then recorded by the Byzantine chronicler Theophanes the Confessor as having been responsible for the sack of the fortress of Charsianon in late 730, but Arab sources credit Mu'awiya ibn Hisham for this act.
The situation in the Caucasus quickly deteriorated after Maslama's departure.
A Khazar expedition into northern Iran (and later into Kurdistan and northern Mesopotamia) led by Barjik, the son of the Khazar khagan, in 730, may be an attempt to establish Khazar rule south of the Caucasus Mountains.
While al-Jarrah campaigns north of the Caucasus, the Khazars swing behind him and attack his main base, Ardabil.
Hastening to relieve the city, an outnumbered force led by al-Jarrah al-Hakami engages the Khazars for three days on the plains surrounding the city of Ardabil in northwestern Iran.
Ultimately, abandoned by many of their mawali auxiliaries, the Caliph's forces are overwhelmed and defeated on December 9, 730.
During the course of the battle, al-Jarrah is killed.
The victorious Barjik mounts his head on top of the throne from which he will command the battles of his Middle Eastern campaign.
According to the historian Agapius, the Arabs suffered twenty thousand dead and twice that number captured, a figure which probably includes the population of Ardabil and the surrounding territories.
Following their victory, the Khazars occupy Ardabil.