A religion is generally said to be a set of beliefs, practices and laws based on the existence of supernatural forces; however, the exact definition of religion has been the subject of much debate throughout history. Religions have existed since prehistoric times, and while some have managed to survive in a recognisable form to present day, many religions go extinct once their originating culture dissolves.
While religions exist in a tremendous variety, many of them share a number of characteristics: they posit that there exists a supernatural world which humans can interact with through rituals and prayer; that there are one or more supernatural intelligences which influence the universe, for better or worse; that these intelligences were responsible for the creation of the universe and humanity; and that these intelligences gifted humanity with a set of laws and morals that must be followed to gain access to a pleasant afterlife. These laws and morals are often a reflection of the social context in which they were created, making many religions difficult to transplant to new locations and necessitating either modifications to the religion to bring it in line with local customs, or the use of force.
The precise origin of religion is a matter of significant debate. While many religions present florid tales of gods walking among men or prophets receiving divine wisdom, modern science has suggested religion is means for the human mind to cope with a world it cannot understand; as a means of providing social cohesion; as a means to justify the enactment of laws; or as a means to subjugate populations.
Because many religions carry within them both an element - or even commandment - of proselytism, and a dogmatic belief that one's own religion is the only correct one, various religions have clashed violently throughout history. With conflicts ranging from mere discrimination to outright war, religion has been one of the major driving forces that shaped, and shapes, the modern world. This influence is still felt today in scientific, social and political matters.
Religion in Star Trek
In the Star Trek universe, religion is seen as a social construct based on lack of accurate information about the universe. While it occasionally performs a socially valuable function, it will eventually, like money, wither away in an advanced civilization. The Vulcans abandoned their gods long ago, and faith in science and progress is the cornerstone of Human advancement.
The Federation's stance on religion has lead to clashes with other civilizations, most notably that of Bajor; while the Federation saw the Prophets as aliens to be studied and explained rationally, the Bajorans instead continued to treat them as true divine beings.
Religion in Star Wars
In the Star Wars universe, religions abound. Many of these religions focus on the Force, yet have differing ways of social interaction. For example, Darth Vader replies to the scorn of "your sad devotion to that ancient religion" by Force-choking the offender; on the other hand, Han Solo's dismissal of "hokey religions" does not upset Obi-Wan Kenobi's calm assurance.
It is worth noting that, unlike many real-life religions, the Force contains a testable element and thus requires no faith as such. Its religious aspects are limited to the interpretations given to it by the inhabitants of the SW universe, and the institutions they have built around it.
The religious themes of faith and repentance are at the heart of the Star Wars movies. Kenobi's faith enables him to sacrifice himself for the others; Luke Skywalker's faith enables him to blow up the Death Star. Han Solo repents of materialism and returns to help Luke; Vader renounces the Sith and returns to the Jedi religion before his death.
Religion is occasionally brought up in the Expanded Universe; for example, during the Yuuzhan Vong invasion, several novels were padded with soul-searching over the difference between "The Living Force" and "The Unifying Force," how they related to "The Potentium," and whether killing in self-defense -- even to remove a cancer -- could ever be considered moral. These arguments were not always well-received.