Religion cant dictate morals, if it does it becomes dogmatic, inflexible, so does not qualify as being perfect. You cant create religion from an invention, well you could but it could not be called perfect.
In response to xris, it seems to me that one of the purposes which religion has in society is to provide the basis of morality. Most religions have much to say about right and wrong. The reference point or source of the moral code is usually considered to be the "Creator" or the "Enlightened One" who knows better than any what is best for human kind. The moral code might be as simple as "show compassion to other beings." This sort of "code" has obvious worth for the survival of the species and of the ecosystem. You are using the term "dogmatic" in a pejorative sense, but beyond that, I am not quite sure what you mean by it.
I look at it this way: It's a creation of the human mind; a way of explaining things we don't understand, grasping for meaning (read: value or purpose) and stilling the voices of doubt and nihilism that inexorably crop up as a result of self-awareness. It fills a personal void in the mind and heart; and as such, is specific from one individual to the next.
Khethil, you present an interesting description of what you believe religion does for individuals. I agree that religious experience
is quite individual, as are the motives for religious belief. I suppose that one could also speak of those needs which all humans have in common (if any can be shown to exist), and suggest what features
a religion might have that would nurture or prod individuals to fulfill their highest potential. This might be based on some advanced research in the social sciences. (If there is a Higher Power or Being, some of these features
would be based on that Being's superior knowledge of how we all "tick", and their efficacy could be verified scientifically.)
In any case, it seems to me that one inherent aspect of religion is an organization
of people around a set of beliefs.
As an organization, there is an interaction between religion and society. The Christian religion has had a great influence on western society, and has had a unifying effect as well (especially among Catholics, who are everywhere and who agree on much.) In addition to religion affecting society, the societies in which a religion exists have an effect on how the religion is practiced.
The above can certainly be said of Islam. I thinks that the extremism that we see in the Muslim world can mostly be attributed to social and political influences: Leaders who, having their own non-religious motives, use the power and influence which religion can have over people to get people to act on their behalf. Most Islamic scholars that I have encountered assert that the Koran does not in any way support the acts of "terrorism" which we see in the world today.
So, in light of all this, I would also suggest that the moral code of the "ideal" ("perfect" is too absolute a concept) religion would forbid people (and even countries) from attacking one another.