Religion was also invented to establish a moral system. It was reasoned that morality "must" come from outside of us, because for some reason we are too deficient to be moral on our own. The strangeness of this "objective" morality is rarely questioned by the majority it is so deeply ingrained by the culture, in my observation.
(For more on how strange it is, read
ETHICS
INVENTING RIGHT AND WRONG
by J. L. Mackie).
As a subjectivist and a strong atheist, it is obvious to me that, OF COURSE, we can be and are moral (or immoral as the individual is so inclined) without outside help (eg: gods) because we ARE, and there are no gods. Therefore atheists can be and are just as moral or immoral as theists; we just recognize that our morality is coming from within us, or from our culture (if we grew up in a cannibalistic or human sacrifice culture, studies strongly show that we would probably have those values too).
As a side not, in addition to being a strong atheist, I am a subjectivist, which means that I think morality has no "object", or floating around "out there" in the universe existence. Morality is what we each decide, and is strongly influenced by our culture (though this can be overruled, of course). In addition, I take subjectivism a step further (I thought and argued about this in my ethics classes) by arguing that morality is NOT different IN KIND (only degree) from taste. I can STRONGLY disapprove of murder or rape; this is only different in the intensity of my emotions from saying that I like ice cream; they are the same KIND of thing. This explains why people split over issues like the death penalty, abortion, euthanasia, etc. etc (and have for recorded history throughout the world). If it was OBJECTIVE and cut and dried like FACTS such as the shape of the Earth, only an idiot would say that the EARTh was flat knowing what we know. People CAN argue about morality in any given situation because morality is NOT objective, it is a matter of individual "taste".