Mu'tadid, the first Caliph to reside permanently in Baghdad after the return from Sakasra, when he enlarged the Hasani, at the close of the third century, is said to have surrounded the palace by a wall, which in part may be identical with the wall which Yakut describes in the beginning of the seventh century. The merchants more especially had their shops in that part of the town which lay immediately to the north of the Palaces, where the roads passing through the quarters converged on the northern gate of the city wall. The third gate in the palace wall, which opened at no great distance to the eastward beyond the two gates of the Willow Tree and of the Date Market, is called the Bab-al-Kasriyah or the Bab Kasr, from the Market of Kasr that lay immediately outside, where had stood the Palace of Kasr, the favourite and all-powerful minister of the Caliph Mu'tadid.