Thou shalt have no other gods before me

"Thou shalt have no other gods before Me" is one of the Ten Commandments found in the Hebrew Bible at and . It is the central tenet of the Abrahamic religions and prohibits the religion's followers from worshipping gods other than the Lord. The sin of worshipping another god is called idolatry. Historically, the punishment for idolatry was often death. 
According to the Bible, the commandment was originally given to the ancient Israelites by the Lord after they had escaped from slavery in Egypt, as described in the Book of Exodus.
The Bible describes how the ancient Israelites, despite being strictly warned not to do so, repeatedly engaged in idolatry and were therefore punished severely by the Lord. Many of the stories in the Bible from the time of Moses to the Babylonian captivity are predicated on the choice between exclusive worship of the Lord and false gods. The Babylonian exile, itself a punishment for idolatry, seems to have been a turning point after which the Jews became committed to monotheism, even when facing martyrdom before worshipping any other god.
The Jewish prayer Shema and its accompanying blessing/curse reveals the intent of the commandment to include love for the Lord and not only recognition or outward observance. In the Gospels, Jesus quotes the Shema as the first and Greatest Commandment, and the apostles after him preached that those who would follow Christ must turn from idols.
Christian theologians teach that the commandment applies in modern times and prohibits the worship of physical idols, the seeking of spiritual activity or guidance from any other source (e.g. magical, astrological, etc.), and the focus on temporal priorities such as self (food, physical pleasures), work, and money, for examples. The Catholic Catechism commends those who refuse even to simulate such worship in a cultural context, since “the duty to offer God authentic worship concerns man both as an individual and as a social being.”
Biblical narrative.
The Book of Exodus tells the story of how the Israelites escape from Egypt after having been kept as slaves for 400 years. While wandering the desert, the Lord appeared to their leader Moses and made an agreement or covenant with him. The Lord declared that the Israelites were his chosen people and that they must obey his laws. These laws were the Ten Commandments delivered to Moses on two stone tables. The first and most important commandment was that they must not worship any god other than the Lord. Whoever violated this commandment should be killed and reads "Whoever sacrifices to any god other than the Lord must be destroyed."
Deuteronomy 13:16-10 specifically prescribes the method of execution to stoning: 
God's interest in exclusive worship is portrayed as a strong jealousy, like that of a husband for his wife:
The Biblical prophets Jeremiah, Ezekiel and Hosea referred to Israel's worship of other gods as spiritual adultery: “How I have been grieved by their adulterous hearts, which have turned away from me, and by their eyes, which have lusted after their idols.” This led to a broken covenant between the Lord and Israel, manifested as defeat by King Nebuchadnezzar of Babylon followed by exile.
Elijah's challenge.
The Bible describes how the Israelites until the Babylonian captivity repeatedly violated the first commandment's demand of exclusive worship. Not only did common people substitute Canaanite gods and worship for that of the Lord, polytheism and worship of foreign gods became official in both the northern and southern kingdoms despite repeated warnings from the prophets of God.
For example, describes how the prophet Elijah tries to convince king Ahab whose land suffers from famine of abandoning worship of Baal and Asherah in favor of the Lord. He assembles all the prophets of Baal and Asherah on Mount Carmel and tells them: "How long will you waver between two opinions? If the Lord is God, follow him; but if Baal is God, follow him." He challenges the prophets to a duel. The prophets whose god can burn meat pieces from a bull is the true God. Baal's and Asherah's prophets fail to set fire to the meat, but Elijah's god succeed. But despite this victory for the Lord, Ahab refuses to change the official, polytheistic policy propelled by his wife Jezebel.
The story of Daniel.
The Bible presents Daniel and his companions as distinct, positive examples of individuals refusing to worship another god, even at the price of their lives. During the time of the exile, Nebuchadnezzar erects a gold statue of himself and commands all subjects to worship it. Three Jewish officials – Shadrach, Meshach, and Abednego – who had been taken to Babylon as youths along with Daniel, refuse to bow to the statue. As they face being burned alive in a furnace, they communicate their faith as well as their resolve: 
In the later reign of Darius, Daniel's refusal to give up private prayer to God and pray to the king instead results in him receiving a death sentence: being thrown into the lions’ den. According to the Book of Daniel, an angel comes and shuts the mouths of the lions so that Daniel is spared and rescued by the king himself the following morning.
In Judaism.
The central prayer of Judaism is the Shema Yisrael in which the belief in a single god is reaffirmed:
The prayer is found in printed form in the "mezuzah", the small, tubed case on the doorposts of homes of observant Jews. This form was chosen to fulfill the "mitzvah" (biblical commandment) to inscribe the words of the Shema "on the doorposts of your house.” “Thousands of martyrs did not go to their deaths muttering a numerical truism. When they said that God is one, they meant that … nothing in the universe is comparable to this God or can take the place of this God … that is why they are willing to die rather than abandon [these values].”
The national resolve toward monotheism solidified during the experience of the Babylonian captivity. In the centuries that followed, Jews were willing to suffer death rather than pay the honor due God to any other man or god. During the early days of the Maccabean revolt, for example, many Jews were martyred because they refused to acknowledge the claims of Seleucid deities. 
Idolatry is one of three sins (along with adultery and murder) the Mishnah says must be resisted to the point of death. By the time the Talmud was written, the acceptance or rejection of idolatry was a litmus test for Jewish identity: “Whosoever denies idols is called a Jew." "Whosoever recognizes idols has denied the entire Torah; and whosoever denies idols has recognized the entire Torah." The Talmud discusses the subject of the worship of other gods in many passages. An entire tractate, the Avodah Zarah (“strange worship”) details practical guidelines for interacting with surrounding peoples so as to avoid practicing or even indirectly supporting such worship. Although Jews are forbidden in general to mock at anything holy, it is meritorious to deride idols. This apparently originated in ancient times, as some of the several Hebrew words from the Tanakh translated as “idol” are pejorative and even deliberately contemptuous, such as "elilim", “powerless ones,” and "gillulim", “pellets of dung.”
Although Jews have characteristically separated themselves from the worship of physical idols or persons claiming divinity since the Babylonian exile, the tendency toward and practice of magic arts (chants, spells, charms, amulets, healing devices, special foods, lucky and unlucky days, magical numbers and a vast array of secret rituals) has continued to be found among some who claim Judaism as their faith. This has been true since ancient times, when the Israelites, having spent 400 years in Egypt, where magic was pervasive, wrongly thought that carrying the Ark of the Covenant into battle would guarantee victory. Such practices, though forbidden, were not surprising since “the ancient Israelites were not immune to the desire to control God.” However, Maimonides warned that special objects (e.g. a mezuzah) and prayers (e.g. the Shema) in Judaism are meant to remind people of love for God and his precepts and do not in themselves guarantee good fortune.
In the New Testament.
According to the gospels, Jesus said the greatest commandment was to “love the Lord your God with all your heart, with all your soul and with all your mind.” The scripture in Deuteronomy to which he referred is known in modern times as the Shema, a declaration emphasizing the oneness of God and the sole worship of God by Israel. In his Sermon on the Mount, Jesus contrasted worship of God and running after material possessions and warned, “You cannot serve both God and money.”
According to Acts, Stephen summarizes the spiritual history of Israel and quotes the prophet Amos, who identified the worship of foreign gods as a reason for Israel's defeat by the Babylonians and subsequent exile. Later in Acts, the apostles discussed the issue of what immediate behavioral changes would be required of gentiles who became followers of Jesus Christ. They decided to instruct new converts: “You are to abstain from food sacrificed to idols, from blood, from the meat of strangled animals and from sexual immorality.”
In Athens, Paul was greatly distressed to see that the city was full of idols, and in the Areopagus, he presented the god of Israel as the creator of everything, as unique and not represented by any idol. He taught:
According to Ephesians, Paul incurred the wrath of silversmiths (worried about losing income from decreased sales of idols) when people responded to his preaching and turned away from idol worship. Paul taught that the gods, which the idols represented, were demons and thus, prohibited Christians from worshiping both God and idols: 
Paul warned the Galatians that those who live in idolatry “will not inherit the kingdom of God,” and in the same passage associates witchcraft with idolatry. In his letter to the Philippians, he refers to those whose “god is their stomach.” In several New Testament scriptures, including the Sermon on the Mount, the term idolatry is applied to the love of money. The apostle James rebukes those who focus on material things, using language similar to that of Old Testament prophets: “When you ask [in prayer], you do not receive, because you ask with wrong motives, that you may spend what you get on your pleasures. You adulterous people, don't you know that friendship with the world is hatred toward God? Anyone who chooses to be a friend of the world becomes an enemy of God.”
Paul commended the church in Thessalonica saying, “Your faith in God has become known everywhere … They tell how you turned to God from idols to serve the living and true God, and to wait for his Son from heaven, whom he raised from the dead—Jesus, who rescues us from the coming wrath.”
Paul identifies the worship of created things (rather than the Creator) as the cause of the disintegration of sexual and social morality in his letter to the Romans. The apostle Peter and the Book of Revelation also refer to the connection between the worship of other gods and sexual sins, whether metaphorically or literally.
The apostle John wrote simply, “Dear children, keep yourselves from idols.”
In the Catholic Church.
The Catholic Church teaches that the first commandment forbids honoring gods other than the one Lord who has revealed Himself, for example, in the introduction to the Ten Commandments: “I am the Lord your God, who brought you out of Egypt, out of the land of slavery." Through the prophets, God calls Israel and all nations to turn to him, the one and only God: "Turn to me and be saved, all the ends of the earth! For I am God, and there is no other. . . . To me every knee shall bow, every tongue shall swear. ‘Only in the LORD, it shall be said of me, are righteousness and strength.' (Isaiah 45:22-24, see also Philippians 2:10-11)”
Because God's identity and transcendent character are described in Scripture as unique, the teaching of the Catholic Church proscribes superstition as well as irreligion and explains the commandment is broken by having images to which divine power is ascribed as well as in divinizing anything that is not God. “Man commits idolatry whenever he honors and reveres a creature in place of God, whether this be gods or demons … power, pleasure, race, ancestors, the state, money, etc.” The "Catechism" commends those who refuse even to simulate such worship in a cultural context and states that “the duty to offer God authentic worship concerns man both as an individual and as a social being.” The "Catechism of the Catholic Church" notes that this commandment is recalled many times throughout the Bible and quotes passages describing temporal consequences for those who place trust elsewhere than in God:
While recognizing that God communicates with people, including prophets, the Catholic Catechism teaches that the first commandment forbids the practice of all attempts to tame occult powers as contradictory to the honor, respect and loving fear that is owed to God alone. Such practices are forbidden even if one has “good” motives, such as seeking to restore someone's health, and “recourse to so-called traditional cures does not justify either the invocation of evil powers or the exploitation of another's credulity.”
Irreligion, in the specific forms of tempting God, sacrilege, and simony, is also considered a violation of the first commandment. The Catechism states that atheism is often based on a “false conception of human autonomy” and all forms of atheism are viewed as violating the first commandment in their common denial of the existence of God. Agnosticism as a way of life is portrayed as a lazy flight from the ultimate question of existence and as “all too often equivalent of practical atheism.”
Reformation and Post-Reformation commentary.
Rev. G. Campbell Morgan emphasized the importance of the first commandment being given after the Lord introduces himself by name, saying, "There is deep significance in the name by which God here declares Himself … to take [the commandment] without the definition of the Person of God is to rob it of its great force."
Morgan argues that everyone has “a center, a motive, a reason, a shrine, a deity somewhere” to which his or her energy and loyalty is directed. “In every case man demands a god, a king, a lawgiver – one who arranges the programme, utters the commandments and demands obedience. This incontrovertible fact reveals the genesis of idolatry.” Morgan goes on to argue that thus “idolatry” is not defined by geography or culture but by the object(s) of worship that are not God, which may be spiritual or physical.
Martin Luther, Matthew Henry, John Calvin, and John Wesley write in their respective commentaries that in the commandment to have no other gods, God is referring to the heart's allegiance. In Luther's exposition of this commandment, he explains:
Like the ancient writers and Jewish theologians (see above), Luther considered occult or magic practices to be in violation of this commandment, explaining that those who seek benefit in such ways “make a covenant with the devil, in order that he may give them plenty of money or help them in love-affairs, preserve their cattle, restore to them lost possessions, etc. For all these place their heart and trust elsewhere than in the true God, look for nothing good to Him nor seek it from Him.” 
Like the New Testament writers, Morgan recognized that departing from the worship of God alone is frequently associated with sexual immorality: “’Tis the homage of the man who, losing his God, worships at the shrine of a fallen Venus.” He references Philippians 3:18-19 to support that gluttony and the pursuit of physical pleasure are also widespread, but not new, examples of idolatry.
Calvin recalls Moses’ warning to the people of Israel, “Ye shall not go after other gods, of the gods of the people which are round about you,” and notes that this commandment was given despite the abundant temptation to superstitions in the cultures all around them and the lack of good examples. He explains that it is not enough that God's followers put him first, while giving lesser respect to other superstitions or objects of worship.
In the first and second of his "Quatre Sermons", Calvin also discouraged believers in Christ from simulating religious acts that are not worship of the true God in order to avoid persecution. He argued that the growth of the Christian church was based on the “seeds sown” by those who were willing to die, if necessary, rather than worship or appear to worship false gods and that without such people there would never have been a Christian church. He said that if one makes choices to suffer nothing for God's word, one changes Jesus Christ to his own image: “Is that not to want to transform Jesus Christ to have him just as our flesh would like him to be?” Pierre Viret, a Swiss Reformed theologian and contemporary of John Calvin, made similar arguments.
Neither Calvin nor Viret advocated reckless martyrdom or purposeful public disturbance, but to the extent possible, to make public choices with “Christian modesty,” even recommending that leaving an area (self-imposed exile) is sometimes the most realistic response to persecution when resources permit.