of the great Khan, who headed westwards. In the 670's they settled in the area known as the Ongal to the north of the Danube delta. From there, Asparukh's cavalry in alliance with local Slavs annually attacked the Byzantine territories in the south. In 680, the Byzantine Emperor Constantine IV led a large army to fight the Bulgars but was defeated in the battle of Ongal and the Byzantines were forced to acknowledge the formation of a new country, the First Bulgarian Empire. The northern border of the country followed the southern slopes of the Carpathian mountains from the Iron Gates and reached the Dneper river or possibly just the Dniester river to the east. The Bulgarians' main rivals in the area were the Avars to the west and the Khazars to the east. The Khazars were a serious threat; they marched westwards after they crushed the resistance of Kubrat's eldest son Bayan and waged a war against Asparukh, who was killed, although not necessarily by a Khazar. To protect their northern borders, the Bulgarians built several enormous ditches that ran the whole length of the border from the Timok river to the Black Sea. In 803, Krum of Bulgaria became Khan. The new, energetic ruler focused on the north-west where Bulgaria's old enemies the Avars experienced difficulties and setbacks against the Franks under Charlemagne. Between 804 and 806, the Bulgarian armies annihilated the Avars and destroyed their state. Krum took the eastern parts of the former Avar Khaganate and took over rule of the local Slavic tribes. Bulgaria's territory extended twice from the middle Danube to the north of present day Budapest to the Dnester, though its possession of Transylvania is debatable. In 813 Khan Krum seized Odrin and plundered the whole of Eastern Thrace. He took 50,000 captives who were settled in Bulgaria across the Danube. During the Middle Ages the Bulgarian Empire controlled vast areas to the north of the river Danube (with interruptions) from its establishment in 681 to its fragmentation in 1371–1422. These lands were called by contemporary Byzantine historians Bulgaria across the Danube, or Transdanubian Bulgaria. Original information for the centuries-old Bulgarian rule there is scarce as the archives of the Bulgarian rulers were destroyed and little is mentioned for this area in Byzantine or Hungarian manuscripts. During the First Bulgarian Empire, the Dridu culture developed in the beginning of the 8th century and