The medina of Rabat is the old city originally established in the 1100s as a citadel and fortress across the river from Salé, or Slaa. It was built as a fortress from which to defend and launch attacks against Iberia. We can see this clearly in the Kasbah of the Udayas, the actual fortress just north of the medina. It’s hard to tell exactly what the town was established for beyond that–i.e., whether the intended residents were just soldiers, or also merchants and other residents. The medina looks a little bit like a grid since most of the streets are straight, but about half of the smaller streets end in dead ends. As Kostof described, the medina is divided up into sections based on general trade: the main street of the market is used for miscellaneous goods, mostly factory-made, and the sections that break off are for trades like pottery, painting, sewing, and food.