However, Frederick II also divorced Agnes due to childlessness in 1243. The haughty Austrian ruler hurled himself into a fierce border conflict with King Béla IV of Hungary and was killed in the 1246 Battle of the Leitha River. As he left no surviving children, the male line of the Babenberg dynasty became extinct with him. The inheritance fell to his sister Margaret and his niece Gertrude.