It’s been customary law in Sweden since pretty much forever. But interestingly it had no explicit foundation in written law until 1994, when a short passage was added to the Swedish constitution: “Everyone shall have access to nature in accordance with ‘allemansrätten’” (“Alla ska ha tillgång till naturen enligt allemansrätten”).