He also built a new mosque, the Barrima Mosque, on the eastern perimeter of the palaces.[1] A state prison was also created within the grounds and annexes of the old Badi Palace, immediately adjacent to Muhammad's new palace.[1]:485 Because of this major construction campaign, the current structures and gardens of the royal palace today date mainly from this period (at least in terms of their overall layout).[1] During this process Muhammad also expanded or developed the kasbah on its south side, creating a number of new mechouars (walled squares) as part of the approach to the royal palace, whose entrance was now reoriented to the south instead of the west.[1] Construction on the main part of Muhammad's new palace was begun in 1747, when he was still viceroy under his father Abdallah. This construction included the creation of the large Arsat an-Nil garden and its surroundings. According to historian Gaston Deverdun, the palace sections on the north side of this garden were probably first finished in 1753-54 but were rebuilt or remodeled between 1760 and 1765, when Muhammad was sultan.[1]:481–482 The southern sections of the palace were probably finished before 1760.