What is the historical meaning of planting your flag regarding land ownership?

If you planted your flag, then that country owned it. This was how people would take over new lands.