I am building a city that the main character will be prohibited to leave from and yet their intentions of entering the city are to save the world form an extra-planer threat. So they have to go in. However, I want to cause hesitation because it is illegal for them to leave the city. However, I cannot think of enough reasons for a city to keep themselves separate from others at least physically.
I'm thinking perhaps those that live in the city get a blessing that cannot be shared with those outside the city. Maybe it is a form of social construct that will make the people closer because they are forced to get along. Secret being kept by city government? Furthermore, only few individuals vetted by the government can leave on diplomatic missions. Supplies are brought through the gates and the merchants stay outside. This would be a medieval era so stone walls would be enough. I am also imagining this city being in a frozen northern land frozen and being run by humans and yeti but that could change.
In Summary: What are reasons that would make a civilization/city closed off from intermingling with other civilizations on pain of death?