The story proceeds from that of the prophet Balaam, in which he ascends the mountain of Pe‘or, and makes sacrifices to God from atop it. Having finished his sacrifices, Balaam views the Israelites on the plain below, and although hired to curse them, pronounces a blessing over them, prophesying their blessed nature and destruction of Moab. When the narrative focus returns to the point of view of the Israelites, the contrast between Balaam's voiced opinion of them, and their actual behaviour, is distinctly noticeable.
According to the Torah, the Israelites, after spending a short time in the plain of Moab, begin to involve themselves with the Moabite women. Consequently, under the influence of Moabite culture, the Israelites begin whoring after the Moabite gods, and join themselves to Baal Peor (Hebrew בעל פעור Ba‘al Pə‘ôr), in the Septuagint Beelphegôr, a baal associated with Mount Pe‘or.
YHWH orders Moses to gather the chiefs of the people and hang up the idolaters before Yahweh to turn away Yahweh's anger. The scene then abruptly shifts from concerns about Moabites to those about Midianites. A man — Israelite Zimri, the son of Salu — brings a Midianite woman into the camp in the sight of Moses, where the people are weeping. Phinehas, grandson of Aaron, thereupon rises up with a spear, follows the man into the chamber and thrusts the spear through both the man and woman, who were evidently in the act of copulation. The plague, from which 24,000 had died, then ceased to take life. A war with Midian follows later.
These, and the biblical back-references, are the only ancient records referring to Ba‘al Pe‘or. There is no way of knowing whether Ba‘al Pe‘or was identical with any other Baal, of which there were several, or was only a local god of Mount Pe‘or. Later commentators tend to suppose that this god might be identical with Chemosh who is called the god of Moab in other biblical texts, and sometimes speculate that the cult of Ba‘al Pe‘or was very licentious.
If Pe‘or is connected to the Hebrew stem p‘r 'open', used both of mouth and bowels, it might mean 'opening' and so Ba‘al Pe‘or could mean 'Lord of the Opening'. This apparent meaning is probably the source of Talmudic traditions associating Ba‘al Pe‘or with exposure and excrement. The tractate Sanhedrin 64a attributes to Rab through Rabbi Judah the story of a sick Gentile woman who vowed to worship every idol in the world if she recovered. Upon recovery she set out to fulfill her vow, but drew back at Pe‘or as the rites were too disgusting: eating beets, drinking strong drink, and then uncovering oneself.
A story follows about a Jew who showed his contempt for the god by wiping his behind on its nose after defecating in the temple and who was praised for his piety by the acolytes of the god who said: no man has ever before served this idol thus. Tractate ‘Avodah Zarah 3 states in the Gemara that the area before the idol Pe‘or was used as a latrine and that the worship of the idol consisted of excrementing before it. Rashi comments on Numbers 25.3 that Pe‘or was so called because they would uncover before it the end of the rectum and bring forth excrement; this is its worship.
The story of Balaam may provide a clue concerning the identity of Baal Peor. Balaam is described as a Prophet of El, usually translated as God. This is one of the first times that El is used, rather than Yahweh, because El can be used to describe angels and even the gods of other nations, and is not necessarily ever relegated to being a personal name like Yahweh, but a title; compare the frequently recurring "Yahweh Elohim" of the Torah. While Balaam is described as a son of Beor, Beor is never himself identified, and the close phonetic similarity to Peor is noticeable. If Beor and Peor are one and the same, then son of Beor merely identifies Balaam as being a prophet of Baal Peor.
Balaam is described as building altars at several of the high places of Moab, including at Peor, without ever criticising any Moabite religion occurring at those locations, entirely plausible if Balaam was a prophet of a Moabite god. Indeed, Balaam's own name is generally considered in critical scholarship to be a compound of Baal and Am, a semitic god. Later in the Bible, within the account of the war against the Midianites, Balaam is described as being amongst those killed for committing the heresy of Peor, implying that Balaam was one of those who had joined themselves to Baal Peor.
An archaeological find from 1967, from Deir Alla in Jordan, produced an ancient Aramaic inscription written in red and black ink on plaster walls, telling about a hitherto unknown prophecy from a Book of Balaam, foretelling destruction for disobedience to the gods. Balaam, though still a son of Beor, in this narrative is a prophet of Shamash, the Semitic sun god (The word "shemesh" is still the Hebrew word for "sun," which in Arabic is "shams"). If this reflects the god that El refers to in the biblical text concerning Balaam, and the connection between Balaam and Baal Peor is accurate, then Baal Peor can be identified as Shamash.
From Moab to Midian
The abrupt change from concerns about the Moabites to the Midianites, and mention of the end of a plague which is never described as starting, is explained by the documentary hypothesis as being down to a change from the JE source to the Priestly source. Despite the Torah redactor usually, according to the hypothesis, interlacing together the sources, the stories here were evidently difficult to combine, as the redactor appears to have cut the end of the JE version, and beginning of the Priestly source version, joining the remaining ends of each source together.
As the Priestly source is considered to be based on the JE source, albeit spun to the Aaronid priesthood's political viewpoint, the original JE ending, and priestly source beginning, can be expected to be fairly similar to the text that is currently present. Nethertheless, the use of plagues, by God, to punish the people in very large numbers, is unique to the Priestly source, once the Israelites have left Egypt, and consequently this detail is unlikely to have been present in the original.
While it is considered uncertain as to why the Priestly source would change Moab to Midian, it is generally agreed amongst critical scholars that the account of the war against Midian, and its spoils, originates from a writer who added these elements to the original version of the Priestly source. The command to vex the Midianites is also considered a part of these additions, and thus the revenge on Midian serves as a vehicle for this writer to include the list of spoils, and its distribution, which has a larger amount of text than the narrative of the war. Thus, this later writer could easily have changed Moab to Midian to facilitate this addition.
Other Baal Peor, of Jordanian-Moabite origin, appeared as both the sun god and moon goddess, as did his priests. Healing was discerned from feces, often salt bathing in the dead sea, and his cult was present in the south dead sea (ie Soddam and Gomorrah legends).