Heresy is a belief that conflicts with established doctrine. The term was originally coined specifically in reference to religion and today may be used more generally to talk about beliefs that appear to be at variance with those generally accepted by society. Historically, religious heresy was considered a crime and people could be severely punished. Today, legal penalties for heresy are unusual in most nations, although there are ecclesiastical penalties for heretics, such as being excommunicated from the faith.
Approaches to religious doctrine vary. Some religions rely on religious texts, opinions of church leaders, and established procedures. Others prefer to stick with specific texts. In fact, debates over the sources for accurate information on doctrine can themselves become heretical; for example, during the rise of the Protestant Church, the Catholic Church condemned many religious leaders as heretics for saying that Christians should be able to read the Bible themselves and should derive information about faith directly from the Bible rather than a priesthood these leaders deemed corrupt.
In the Christian faith, beliefs about heresy and punishments for heretics led to a series of persecutions in the Middle Ages and through the Protestant Reformation. Christians who professed beliefs thought to be at odds with dogma could be subjected to punishments like torture and execution. Members of other faiths, like Judaism, were subject to similar punishments. In regions like Spain, some people converted or pretended to convert to Christianity to stay in their homeland during a series of expulsions targeting heretics, with many living in fear that they would be outed as converts and accused of heretical thinking.
Social attitudes about religion and heresy underwent a shift after the Reformation; while people were still accused of heresy and could face social ostracism for espousing beliefs that appeared to conflict with Christian conflict, they didn't risk torture and execution for their beliefs. Heresy was no longer treated as a crime against society, but rather a matter for the Church to deal with on its own. People who confess heretical beliefs can still be expelled from religious organizations, and in regions where religious faith and social status are closely tied, heretics may find it difficult to work and live in their communities after excommunication.
Most legal courts around the world do not recognize charges of heresy. Instead, they are tried in ecclesiastical courts, courts convened specifically to address religious matters. These courts are overseen by church officials and involve lawyers with training in the area of ecclesiastical law. They generally do not have jurisdiction over people who are not members of the faith.