"But one who looks intently at the perfect law, the law of liberty, and abides by it, not having become a forgetful hearer but an effectual doer, this man shall be blessed in what he does." James 1:25
A few years ago I read a story about a school where the administrators determined that the fence around the playground was too limiting to the children. It was a hindrance to their freedom. So they had the fence removed. To their surprise, the children afterward voluntarily played in a much smaller area than what had originally been allowed by the fence. They suddenly had no boundary and weren't able to figure out how to limit themselves, so they stuck together for the sake of safety. Also, the new arrangement no longer prevented the outside world, such as strangers, from getting in.
The lesson here is that the fence, properly placed, actually promoted freedom for the children. They could play right up to the fence without facing danger. The playground was large enough for them to play in comfortably, and the fence kept them in and strangers out. This is how God's law works. He provides the proper boundaries for us to promote our maximum freedom. Another example of this would be the barrier on the observation deck of the Empire State Building or the railing at the rim of the Grand Canyon. People can go right to the edge and even lean against the boundary because the boundary was constructed to allow leaning against it. Now imagine these railings suddenly being removed. How many people would venture to the edge of the top floor and look down? Far less than with a boundary.
An opposite example would be Hal, the super computer in the movie 2001: A Space Odyssey. Hal arranged for Dave, the astronaut, to float out into space in order to take control of things himself. Dave was now free of any and every obligation to family, country, mother-in-law. He was even free from the law of gravity. But he was doomed to death because of his limitless freedom. God's law allows us freedom to live within his creation, but prevents us from killing ourselves.