A lot of Medieval emperors built walled quarters for Jews in their kingdoms, sometimes on the request of the Jewish inhabitants, and sometimes as a way to encourage more Jewish residents in their kingdoms. These walls afforded a certain degree of protection and privacy to them.