In 1273 King Otakar II of Bohemia took over the castle and took the children of Sopron's noble families as hostage. But the people of the city opened the gates when the army of King Ladislaus IV of Hungary arrived. The King Ladislaus made Sopron a free royal town.