Gods, as the explanations of awe-inspiring natural phenomena, is the usual means through which one analyses the concept. But beyond 'God the Creator', there exists a deeper and more important character associated with God/s that is often either overlooked or under-emphasized. That role is the natural justification of a system of morality.
Man can not rule Man:
The title here is the description of the phenomenon of anti-incumbency. As soon as a sufficiently rebellious person realizes that a given edict of law is simply a creation of Man (synthetic), he automatically decides that there is no particular reason he should be bound by it. The resultant is of course the emergence of factions that oppose the current set of laws governing the behavior of men.
I have tried to consistently put forth that Morality is Normative in nature by definition; a well known but ill-understood fact. I'm hardly the only one to realize the result of the fact that 'Man cannot rule man' and the non-objective nature of Morality means that some inhuman, nay, superhuman entity must declare their support for edicts of man. This purpose is often served by gods. The religious texts i.e. the scriptures are exactly that: The divine Justifiers of laws of Mortal making. Any organization that creates such rules, at some point MUST run against this inevitable obstacle where they can NOT offer any explanation as to what makes their decisions and authority superior to those of other men. In an amazing act of literal self-less-ness they choose to preserve their creation over their name by ascribing the authorship of the text to Gods.
Now, this concept is a secondary trait of god, beyond their primary function as creators of Mortal worlds. But since His role in creation has LESS to do with mundane Mortal affairs than the regulation of everyday behavior, the secondary trait easily takes over as the chief function of the gods. A secondary function is NOT a function of less importance as language might lead you to believe but rather a function that depends on the primary.