After centuries of fighting involving all their neighbours—the Byzantine Empire, Bulgaria, Kievan Rus', Khazaria, and the Magyars—the Pechenegs were annihilated as an independent force in 1091 at the Battle of Levounion by a combined Byzantine and Cuman army under Byzantine Emperor Alexios I Komnenos. Alexios I recruited the defeated Pechenegs, whom he settled in the district of Moglena (today in Macedonia) into a tagma "of the Moglena Pechenegs". Attacked again in 1094 by the Cumans, many Pechenegs were slain or absorbed. The Byzantines defeated the Pechenegs again at the Battle of Beroia in 1122, on the territory of modern-day Bulgaria. For some time, significant communities of Pechenegs still remained in the Kingdom of Hungary. With time the Balkan Pechenegs lost their national identity and became fully assimilated, mostly with Magyars and Bulgarians.