Andrew used the funds that he inherited from his father to recruit supporters among the Hungarian lords. He also formed an alliance with Leopold VI, Duke of Austria, and they plotted against Emeric. Their united troops routed the royal army at Mački, Slavonia, in December 1197. Under duress, King Emeric gave Croatia and Dalmatia to Andrew as an appanage. In practice, Andrew administered Croatia and Dalmatia as an independent monarch. He minted coins, granted land and confirmed privileges. He cooperated with the Frankopans, Babonići, and other local lords. The Canons Regular of the Holy Sepulchre settled in the province during his rule. Taking advantage of Miroslav of Hum's death, Andrew invaded Hum and occupied at least the land between the Cetina and Neretva rivers. He styled himself, "By the grace of God, Duke of Zadar and of all Dalmatia, Croatia and Hum" in his charters.