However , soon afterwards Panah Ali khan realized that in order to secure himself and his newly-established khanate from external threats , and especially from the invasions from Iran , he needed to build a new more reliable castle .
However , soon after Panah Ali Khan realized that in order to secure himself and his newly-established khanate from external threats , and especially from the invasions from Iran , he needed to build a new more reliable castle .