Hmmmn, really law is created for many reasons which some people have pointed out, among others which could be to control a setting or people from being lawless, to guide a certain group of people or settings, or to have a standard, ordinances and or orderliness in a particular setting etc.
One very good thing I observed is that often laws are created due to selfish motive of the creator of such laws. When we vividly sit to examine any law of any settings you will notice some clauses and agree with me that those caluses are created due to selfish reason of one or more people who created such laws. No law is exceptionally diferrent or excludes the above observation ranging from the UN International laws and principles to laws of the smallest group in any society.
Let us always remember that what goes round comes round, if any law is created today with a selfish motive you (the creator of that law), somehow someday will be a victim of violation of that law. Then what happens when this occurs? Most times we tend to try to twist the law to get out of it by getting a good interpreter of law who are often Lawyers to bail us out.
In a nutshell, let us all (from the World powers to the common man in any society) take away selfish motives whenever we are trying to create a governing law.