It was a military decision as much as a political one.
At the time, 17th century technology allowed for the maximum distance a cannon shell could be fired was about twelve nautical miles, countries used that measurement as the point at which shore-based artillery could offer protection. That way, if an attacking fleet sailed within that boundary, it was fair game to be fired upon. Also, keeping enemy ships outside of that boundary meant that their cannons could not be effective in hitting land-based targets.