In the 16th century , the Sa'adi monarchy , particularly under Ahmad AL-MANSUR ( 1578 - 1603 ) , repelled foreign invaders and inaugurated a golden age .