The kasbah also had the secondary function of providing an additional line of defense for the palaces along this part of the perimeter, as the mechouar here was more thinly protected from the outside than other parts of the perimeter.[1]:41