Matthew III Csák
The new castle faced further conflicts. In 1271, King Otakar II of Bohemia invaded the territory of today's western Slovakia and charged the knight Egid with the administration of the conquered castle. Egid rebelled against Otakar two years later and was defeated by Otakar, but due to problems in Bohemia, Otakar had to leave this territory. In 1285-86, the noble Nicholas Kőszegi occupied the castle in order to use it as a basis for a rebellion against the Hungarian king, but he was defeated. Shortly afterwards, 1287–1291, the Austrian duke Albert of Habsburg, supporting Nicholas, occupied the castle, but was defeated by Matthew III Csák, who was made county head of Pozsony county for this. A more or less successful Austrian occupation of the castle and the county occurred in 1302-1312/1322 by Duke Rudolf.