Heresy is any belief or theory that is strongly at variance with established beliefs or customs. Heresy is distinct from both apostasy, which is the explicit renunciation of one's religion, principles or cause,  and blasphemy, which is irreverence toward religion. Heresy is usually used to discuss violations of religious or traditional laws or legal codes, although it is used by some political extremists to refer to their opponents. It carries the connotation of behaviors or beliefs likely to undermine accepted morality and cause tangible evils, damnation, or other punishment. In some religions, it also implies that the heretic is in alliance with the religion's symbol of evil, such as Satan or chaos.  In certain historical Christian, Jewish, and some modern cultures, espousing ideas deemed heretical was punishable by law.Etymology
The term heresy is from Greek αἵρεσις originally meant "choice", but also referred to that process whereby a young person would examine various philosophies to determine how to live one's life. The word "heresy" is usually used within a Christian, Jewish, or Islamic context, and implies slightly different meanings in each. The founder or leader of a heretical movement is called aheresiarch, while individuals who espouse heresy or commit heresy are known as heretics. Heresiology is the study of heresy.Christianity

The use of the word "heresy" was given wide currency by Irenaeus in his tract Contra Haereses (Against Heresies) to describe and discredit his opponents during the early centuries of the Christian community. He described the community's beliefs and doctrines as orthodox  and the Gnostics' teachings as heretical. He also pointed out the concept of apostolic succession to support his arguments. 
Constantine the Great, who along with Licinius had decreed toleration of Christianity in the Roman Empire by what is commonly called the "Edict of Milan", and was the first Roman Emperor to be baptized, set precedents for later policy. By Roman law the Emperor was Pontifex Maximus, the high priest of the College of Pontiffs (Collegium Pontificum) of all recognized religions inancient Rome. To put an end to the doctrinal debate initiated by Arius, Constantine called the first of what would afterwards be called the ecumenical councils  and then enforced orthodoxy by Imperial authority. The first known usage of the term in a legal context was in 380 AD by the Edict of Thessalonica of Theodosius I,  which made Christianity the State church of the Roman Empire. Prior to the issuance of this edict, the Church had no state-sponsored support for any particular legal mechanism to counter what it perceived as "heresy". By this edict the State's authority and that of the catholic Church became somewhat overlapping. One of the outcomes of this blurring of Church and State was the sharing of State powers of legal enforcement with Church authorities. This reinforcement of the Church's authority gave Church leaders the power to, in effect, pronounce the death sentence upon those whom the Church considered heretical.Within five years of the official criminalization of heresy by the Emperor, the first Christian heretic to be prosecuted, Priscillian, was executed in 385 by Roman officials. However, his accusers were excommunicated both by Ambrose of Milan and Pope Siricius.  For some years after the Reformation, Protestant churches were also known to execute those whom they considered to be heretics, including Catholics. The last known heretic executed by sentence of the Roman Catholic Church was Cayetano Ripoll in 1826. The number of people executed as heretics under the authority of the various "ecclesiastical authorities"  is not known.  Catholicism
               The Roman Catholic Church had always dealt harshly with strands of Christianity that it considered heretical, but before the 11th century these tended to centre around individual preachers or small localised sects, like Arianism, Pelagianism, Donatism, Marcionism and Montanism. The diffusion of the almost Manicheansect of Paulicians westwards gave birth to the famous 11th and 12th century heresies of Western Europe. The first one was that of Bogomils in modern dayBosnia, a sort of sanctuary between Eastern and Western Christianities. By the 11th century, more organised groups such as the Patarini, the Dulcinians, theWaldensians and the Cathars were beginning to appear in the towns and cities of Northern Italy, Southern France and Flanders.

In France the Cathars grew to represent a popular mass movement and the belief was spreading to other areas.  The Cathar Crusade was initiated by the Roman Catholic Church to eliminate the Cathar heresy in Languedoc.  Heresy was a major justification for the Inquisition (Inquisitio Haereticae Pravitatis, Inquiry on Heretical Perversity) and for the European wars of religion associated with the Protestant Reformation.

A few early modern scientists were accused of heresy by the Catholic Church. Giordano Bruno, who believed that the universe contained numerous suns, planets, and worlds similar to Earth, and that other such worlds could contain sentient beings, was condemned as a heretic by the Church and burned at the stake. Some sources claim that Bruno's scientific views motivated his prosecution, but other sources say that only his theological views motivated it, in particular, "that Christ was not God but merely an unusually skillful magician, that the Holy Ghost is the soul of the world, that the Devil will be saved, etc." Galileo Galilei was alsobrought before the Inquisition for heresy, but recanted and was condemned to house arrest (where he spent the rest of his life) instead of being burnt at the stake.Eastern ChristianityIn Eastern Christianity heresy most commonly refers to those beliefs declared to be heretical by the first seven Ecumenical Councils. Since the Great Schism and the Protestant Reformation, various Christian churches have also used the concept in proceedings against individuals and groups deemed to be heretical by those churches.ProtestantismOne example of a few of the alleged heretics who were executed under Protestant church law was the execution of the Boston martyrs in 1659, 1660, and 1661. These executions resulted from the actions of the then ultra orthodox protestant "Puritan" sect, which during those years operated as a de facto church-state institution holding nearly absolute authority over the Massachusetts Bay Colony. At the time, the colony leaders were apparently hoping to achieve their vision of a "purer absolute theocracy" within their colony. As such, they perceived the teachings and practices of the rival Quaker sect as heretical, even to the point where laws were passed and executions were performed with the aim of ridding their colony of such perceived "heresies". This example is by no means unique to the times.In England, the sixteenth century European Reformation resulted in a number of executions on charges of heresy. During the thirty-eight years of Henry VIII's reign, about sixty heretics, mainly protestants, were executed and a rather greater number of catholics lost their lives for political offences such as treason, notably Sir Thomas More and Bp. John Fisher when their actions were motivated by their loyalty to the Pope. Under Edward VI, the heresy laws were repealed in 1547 only to be reintroduced in 1554 by Mary Tudor; even so two radicals were executed in Edward's reign (one for denying the reality of the incarnation, the other for denying Christ's divinity).  Under Mary, around two hundred and ninety people were burnt at the stake between 1555 and 1558 after the restoration of papal jurisdiction.  When Elizabeth I came to the throne, the concept of heresy was retained in theory but severely restricted by the 1559 Act of Supremacy and the one hundred and eighty or so catholics who were executed in the forty-five years of her reign were put to death because they were considered to be members of "a subversive fifth column" . The last execution of a "heretic" in England occurred under James I in 1612. Christian heresy in the modern era
Although less common than in the medieval period, formal charges of heresy within Christian churches still occur. Key issues in the Protestant churches have included modern biblical criticism, the nature of God, and the acceptability of gay clergy. The Catholic Church, through the Congregation for the Doctrine of the Faith, appears to be particularly concerned with academic theology.
 Perhaps due to the many modern negative connotations associated with the term heretic, such as the Spanish inquisition, the term is used less often today. There are however, some notable exceptions: see for example Rudolf Bultmann and the character of debates over ordination of women and gay priests. The subject of Christian heresy opens up broader questions as to who has a monopoly on spiritual truth, as explored by Jorge Luis Borges in the short story "The Theologians" within the compilation Labyrinths. Islam Many in the two main bodies of Islam—Sunnis and the Shi'as—have regarded the other as heretical. Groups like the Ismailis, the Hurufiya, the Alawis, the Bektashi and the Sufis have been regarded as heretical by many, such as the ultra-conservative Salafi. Although Sufism is often though not completely accepted as valid by some Shi'a and many Sunnis, the relatively recent movement of Wahhabism view it as heretical.Starting in medieval times, Muslims began to refer to heretics and those who antagonized Islam as zindiqs, the charge being punishable by death. Medieval Muslim scholars and philosophers such as Avicenna and Averroes were condemned as heretics. In some modern day nations and regions in which Sharia law is ostensibly practiced, heresy remains as an offense which may be punishable by death. One example of such is the recent fatwaissued by the government of Iran, offering a substantial bounty for anyone who might succeed in the assassination of author Salmon Rushdie, whose writings have been declared as "heretical".Judaism Orthodox Judaism Orthodox Judaism considers views on the part of Jews which depart from the traditional Jewish principles of faith to be heretical. In addition, the more right-wing groups within Orthodox Judaism hold that all Jews who reject the simple meaning of Maimonides's 13 principles of Jewish faith are heretics.  As such, most of Orthodox Judaism considers Reform and Reconstructionist Judaism to be heretical movements, and regards most of Conservative Judaism as heretical. The liberal wing of Modern Orthodoxy is more tolerant of Conservative Judaism, particularly its right wing, as there is some theological and practical overlap between these groups.Other religionsHinduism ignored or absorbed its heretics. In chapter XVI, the Bhagavad-Gita makes passing reference to heretics (as the Unheavenly). Buddhist literature mentions a wrathful conquest of Buddhist heretics (see Padmasambhava) and a Buddhist theocracy once existed, but Buddhism doesn't accept the use of violence. Neo-Confucian heresy has been described. The act of using Church of Scientology techniques in a form different than originally described by Hubbard is referred to within Scientology as "squirreling" and is said by Scientologists to be "high treason".  The Religious Technology Center has prosecuted breakaway groups that have practiced Scientology outside the official Church without authorization.Non-religious usageIn a secular, multi-polar world, the term heresy has lost utility outside of a well-defined (usually religious) context. While heresy is pejorative in a religious context and in some political contexts, it may be complimentary in other contexts where innovation is more welcome.Today, heresy can be without a religious context as the holding of ideas that are in fundamental disagreement with the status quo in any practice and branch of knowledge. Scientist/author Isaac Asimov considered heresy as an abstraction, mentioning religious, political, socioeconomic and scientific heresies. He divided scientific heretics into endoheretics (those from within thescientific community) and exoheretics (those from without). Characteristics were ascribed to both and examples of both kinds were offered. Asimov concluded that science orthodoxy defends itself well against endoheretics (by control of science education, grants and publication as examples), but is nearly powerless against exoheretics. He acknowledged by examples that heresy has repeatedly become orthodoxy.The revisionist paleontologist Robert T. Bakker, who published his findings as The Dinosaur Heresies, treated the mainstream view of dinosaurs as dogma.  He is an example of a recent scientific endoheretic.Immanuel Velikovsky is an example of a recent scientific exoheretic; He did not have appropriate scientific credentials or publish in scientific journals. While the details of his work are in scientific disrepute, the concept of catastrophic change (extinction event and punctuated equilibrium) has gained acceptance in recent decades.The term heresy is also used as an ideological pigeonhole for contemporary writers because, by definition, heresy depends on contrasts with an established orthodoxy. For example, the tongue-in-cheek contemporary usage of heresy, such as to categorize a "Wall Street heresy" a "Democratic heresy" or a "Republican heresy", are metaphors which invariably retain a subtext that links orthodoxies in geology or biology or any other field to religion. These expanded metaphoric senses allude to both the difference between the person's views and the mainstream and the boldness of such a person in propounding these views.