Tomislav was the first king of Croatia, styled as such in a letter of Pope John X in 925. Tomislav defeated Hungarian and Bulgarian invasions, spreading the influence of Croatian kings. The medieval Croatian kingdom reached its peak in the 11th century during the reigns of Petar Krešimir IV (1058–1074) and Dmitar Zvonimir (1075–1089). When Stjepan II died in 1091, ending the Trpimirović dynasty, Dmitar Zvonimir's brother-in-law Ladislaus I of Hungary claimed the Croatian crown. This led to a war and personal union of Croatia and Hungary in 1102 under Coloman.