The military history of Croatia encompasses wars, battles and all military actions fought on the territory of modern Croatia and the military history of the Croat people regardless of political geography. Medieval Croatian states Croatian principalities The first mention of Croatian military actions dates from the time of the Croatian principalities in the 8th and 9th centuries. Vojnomir led a Croatian army in wars against the Avars at the end of the 8th century. He launched a joint counterattack with the help of Frankish troops under Charlemagne in 791. The offensive was successful and the Avars were driven out of what then became Lower Pannonia under Frankish overlords. In 819, his successor Duke Ljudevit Posavski raised a rebellion against the Franks. Ljudevit won many battles against the Franks, but in 822 his forces were defeated. Prince Borna of Croatia led the army of Dalmatian Croatia and had a primary role in crushing Ljudevit's rebellion. Borna reported his successes to the Frankish Emperor, stating that Ljudevit had lost over 3,000 soldiers and 300 horses during his campaign. Prince Trpimir I of Croatia battled successfully against his neighbours, the Byzantine coastal cities under the strategos of Zadar in 846–848. In 853 he repulsed an attack from an Army of the Bulgarian Khan Boris I and concluded a peace treaty with him, exchanging gifts. Prince Domagoj of Croatia is known in the history for his navy which helped the Franks to conquer Bari from the Arabs in 871. During Domagoj's reign piracy was a common practice, which earned him a title of The worst duke of Slavs (). One of the strongest Croatian princes was Branimir, whose naval fleet defeated the Venetian navy on 18 September 887. Kingdom of Croatia First Croatian king Tomislav defeated the Magyar mounted invasions of the Arpads in battle and forced them across the Drava River. In 927 Tomislav's army heavily defeated the army of Bulgarian Emperor Simeon, under the command of general Alogobotur in the Battle of the Bosnian Highlands. One of Tomislav's admirals lead more than 5,000 sailors, soldiers and their families into Slavic quarter of Palermo, Sicily. At the peak of his reign, according to Byzantine emperor Constantine VII Porphyrogenitos' De Administrando Imperio, written around 950, Tomislav could raise a vast military force composed out of 100,000 infantrymen and 60,000 horsemen and a sizable fleet of 80 large ships and 100 smaller vessels. According to