The Battle of Mohács (1526) and the death of King Louis II ended the Hungarian-Croatian union. In 1526, the Hungarian parliament elected two separate kings János Szapolyai and Ferdinand I Habsburg, but the choice of the Croatian sabor at Cetin prevailed on the side of Ferdinand I, as they elected him as the new king of Croatia on 1 January 1527, uniting both lands under Habsburg rule. In return they were promised the historic rights, freedoms, laws and defence of Croatian Kingdom.