 The Khazars and the Arabs came into conflict as a result of the first phase of Muslim expansion : by 640 , the Arabs had reached Armenia , and in 642 , they launched their first raid across the Caucasus under Abd ar @-@ Rahman ibn Rabiah . In 645 / 646 , the Arabs defeated a Byzantine army in Armenia , reinforced with Khazar and Alan contingents . It was followed by an attempt in 651 / 652 to advance onto the Khazar capital , Balanjar , but the Arabs were heavily defeated in a battle before the city , resulting in the death of Abd ar @-@ Rahman 's brother Salman and 4 @,@ 000 Muslim troops . Three years later , the Khazars repelled a retaliatory campaign under Habib ibn Maslama . 
