There's a big difference between a wall to keep your own people from escaping, and one to keep others from invading your country.

It'S the difference between locking the door to your home to keep anyone who likes it better than their own home from moving in, and locking your own family inside so they can't escape.