The early 13th century was marked by a decline in external hostilities. The Dalmatian cities started accepting foreign sovereignty (mainly of the Republic of Venice) but eventually they reverted to their previous desire for independence. The Mongol invasion severely impaired Hungary, so much that in 1241, the king Bela IV had to take refuge in Dalmatia (in the Klis fortress). The Mongols attacked the Dalmatian cities for the next few years but eventually withdrew.