In 1494 the Aq Qoyunlu captured Ardabil, killing Ali Mirza Safavi (the eldest son of Haydar), and forcing the 7-year old Ismail to go into hiding in Gilan, where under Sultan 'Ali Mirza Karkiya he received education under the guidance of scholars.