Expansion, internal conflicts and legislation (1096–1105)
After Coloman's victories over the crusaders, Henry IV, Holy Roman Emperor, whom Ladislaus I had supported against Pope Urban II in his last years, wrote a letter to Duke Álmos. The emperor stated that Coloman had neglected imperial interests "because of his own necessities", and asked the duke to intervene on his behalf. However, Coloman—a former bishop—abandoned his predecessor's foreign policy and supported the pope. Historian Gyula Kristó writes that Álmos's close relationship with Emperor Henry may also have influenced Coloman's decision. Coloman married Felicia, a daughter of Roger I of Sicily—a close ally of the Holy See—in 1097. Her sister Constance had married Conrad, the elder son of Emperor Henry IV, after he allied with the pope against his father.
Coloman invaded Croatia in 1097. Ladislaus I had already occupied most of the country, but Petar Snačić, the last native king of Croatia, resisted him in the Mala Kapela mountains. Petar Snačić died fighting against Coloman's army in the Battle of Gvozd Mountain. The Hungarian troops reached the Adriatic Sea and occupied Biograd na Moru, an important port. Threatened by the advance of Coloman's army, the citizens of the towns of Trogir and Split swore fidelity to the doge of Venice, Vitale Michiel, who had sailed to Dalmatia. Having no fleet, Coloman sent envoys with a letter to the doge to "remove all the former misunderstandings concerning what is due to one of us or the other by right of our predecessors". Their agreement of 1098—the so-called Conventio Amicitiae—determined the spheres of interest of each party by allotting the coastal regions of Croatia to Hungary and Dalmatia to the Republic of Venice.
Taking advantage of Coloman's absence, Álmos began to conspire against the king and mustered his armies. Coloman returned from Croatia and marched his army towards his brother's duchy in 1098. The two armies met at Tiszavárkony, with only the river Tisza separating them. However, the commanders of the two troops started negotiations and decided not to fight each other, compelling the king and the duke to make peace.
[Coloman] and his army marched to [Tiszavárkony] against [Álmos], and [Álmos] drew near to [Tiszavárkony] from the opposite direction, and between them was the river [Tisza]. But loyal Hungarians sought to bring about a truce, in order that they could talk with each other, and they said: "Why do we fight? If they defeat us in battle, we shall die; and if they escape, they will flee: in times past our fathers fought against each other and brothers against brothers, and they died. Nor do we see any ground for fighting. Let those two fight if fighting pleases them; and whichever of them shall win, let us take as lord." Having taken this decision, the chief men dispersed. When Grak told [Coloman] of their decision and Ilia informed [Álmos], they kept the peace, though it was not by their own will.
Grand Prince Svyatopolk II of Kiev sent his son Iaroslav – who was the husband of one of Coloman's nieces – to Hungary to seek assistance against the princes of the westernmost regions of Rus' in 1099. Iaroslav persuaded Coloman to intervene in the conflict. Coloman and his army crossed the Carpathian Mountains and laid siege to Peremyshl (Przemyśl, Poland)—the seat of Volodar Rostislavich, one of the rebellious princes. David Igorevich, one of Volodar Rostislavich's allies, persuaded the Cumans to attack the Hungarians. In the ensuing battle, the Hungarian army was soundly defeated. The Illuminated Chronicle says that "[r]arely did Hungarians suffer such slaughter as in this battle". According to the Russian Primary Chronicle, many Hungarians "were drowned, some in the Vyagro and others in the San", after the battle. Coloman himself narrowly escaped from the battlefield through the valley of the San. Shortly after his return from Rus', Coloman hastened towards the Bohemian border to assist the dukes of Moravia—Svatopluk and Otto—against Duke Bretislaus II of Bohemia. He had a meeting with Bretislaus on the border river Olšava "in the field of Lučsko" where "they renewed their age-old bonds of friendship and peace and confirmed them with oaths", according to Cosmas of Prague.
Coloman decided to review his predecessors' decrees around 1100. Because he regarded Stephen I of Hungary, who had been canonized in 1083, as his ideal, he "assembled the magnates of the kingdom and reviewed with the advice of the entire council the text of the laws" of Stephen I. The assembly also passed decrees, which regulated several aspects of the economy and tempered the harshness of the legislation of Ladislaus I. One of the decrees prohibited the persecution of strigae—vampires or mares—because they "do not exist". The same law also dealt with malefici or "sorcerers", punishing their misdeeds. Taxes on trade were increased under Coloman, implying that commerce flourished in his reign. However, his legislation prohibited the export of Hungarian slaves and horses. Coins minted during his reign were smaller than those issued in his predecessor's reign to prevent the cutting down of their smooth edge.
Coloman was crowned king of Croatia in Biograd na Moru in 1102. In the 13th century, Thomas the Archdeacon wrote that the union of Croatia and Hungary was the consequence of conquest. However, the late 14th-century Pacta conventa narrates that he was only crowned after he had reached an agreement with twelve leading Croatian noblemen, because the Croats were preparing to defend their kingdom against him by force. Whether this document is a forgery or an authentic source is a subject of scholarly debate. According to the historian Pál Engel, even if the document is a forgery, its content "is concordant with reality in more than one respect" concerning the special status of Croatia throughout the Middle Ages. For instance, in case of a foreign invasion, Croatian noblemen were obliged to fight at their own expense only up to the river Drava, which was considered the border between Croatian territories and Hungary.
Coloman was a man of warlike spirit, and resolved to subjugate to his lordship all the land to the Adriatic Sea. He came with a force of arms and took possession of the remaining part of Slavonia, which Ladislas had passed over.
In an attempt to prevent an alliance between Coloman and Bohemond I of Antioch, the Byzantine Emperor Alexios I Komnenos arranged a marriage between his son and heir, John, and Coloman's cousin, Piroska, in 1104 or 1105. The alliance with the Byzantine Empire also enabled Coloman to invade Dalmatia in 1105. According to the Life of the blessed John of Trogir, he personally commanded his troops besieging Zadar, the most influential among the Dalmatian towns. The siege lasted until Bishop John of Trogir negotiated a treaty between Coloman and the citizens who accepted the king's suzerainty. The town of Split likewise surrendered after a short siege, but two other Dalmatian towns—Trogir and Šibenik—capitulated without resistance. The Life of St Christopher the Martyr also says that a Hungarian fleet subjugated the islands of the Gulf of Kvarner, including Cres, Krk, and Rab, as well as Brač. Thomas the Archdeacon narrates that Coloman granted each Dalmatian town its own "charter of liberties" to secure their loyalty. These liberties included the citizens' right to freely elect the bishop of their town and their exemption from any tribute payable to the monarch. Following his conquest of Dalmatia, Coloman assumed a new title—"King of Hungary, Croatia and Dalmatia"—which was first recorded in 1108.