I imagine that during the medieval era and beyond that a nations territory was vague, and difficult to police. How long have countries had definitive borders that monitored entrants and regulated who can and cannot travel through? Did historical nations even have any desire to doing so?

by IAmClanky
Superplaner

First of all "medieval era" isn't really a particularly well defined period and how this worked absolutely varied between regions but I am going to assume normal eurocentrism when talking about medieval stuff. If you want information about some other part of the world, feel free to specify.

Now, imagine you are the King of France, obviously your name is Philip or Louis. You are sitting in your castle in Paris looking at a map of your realm. You have visited some of the major cities, you fought the occasional war against your unruly neighbours in the east. You're pretty familiar with that part of the country from your campaigns there. But what about the south?

To the south your Kingdom is separated from another Kingdom by a mountain range and although it has been generally agreed that this natural border is the national border too. You don't quite know where exactly in the mountains your Kingdom ends and that of King Philip of Spain begins. So, while you may not know exactly and the map will at best give some general indication there are definitely people that do know exactly where your border is. Your local minor nobles in the south of France.

Their lands are small, perhaps just a single estate and a village or two. The ones on the very border with Spain will know that this valley, as long as it rises, is his. As soon as you go over the pass and start descending again, your are no longer in his land but in the domain of his counterpart on the Spanish side (this is called a drainage divide if you're super into borders, it basically means that the border is established according to where water will drain. If it rains and the water drains into France, you're in France. If it drains into Spain, you're in Spain). It's very much in the interests of this minor noble to keep track of where his lands start and end. As we see here, a smaller natural border is again the national border, the mountain pass.

This was just a made-up example but there was generally someone who had a vested financial interest in keeping track of travel and trade. Usually whoever had the toll rights. Sometimes a noble, sometimes a city council or other holder of that privilege. In either case, there is definitely someone who keeps track of travel and can, at least in theory, stop you.

This holds true for central Europe, for the most part at least. It becomes more fuzzy if you look at more sparsely populated areas. The border between Sweden and Norway for example. There were, for long periods of time, large areas where there was no point in deciding exactly where the border was because there was nothing there. Just mountains. Even today the border is largely unmarked unless you're following a road and there is nothing stopping you from walking from one country to the other.