Part of the work done by the Torah is settle arguments that we don't have any more. One of the those arguments is the relationship between El and YHWH. I've pointed out a passage before that tries to say they are the same God, but there still exist remnants from the Elohimists and the Yahwehists, even visible to the untrained eye reading the Scripture in a modern language.
I mention that because we have a weird pair of stories. On the one hand, we have Balaam. A priest of Yehweh, or Elohim, or maybe he can just talk to them. Here's a neat little piece examining the ideas noting that "As modern scholarship and the biblical text both demonstrate, the convergence between Yhwh and El in the minds of ancient Israelites already took place in biblical times." Anyway, thing is, non-Hebrew who is a good guy and passes along God's message.
Meanwhile, back at the ranch, the Israelites are being seduced, literally and figuratively, by those dirty Midianites. (Whores!) And so they are worship Baal of Peor. Gross. They end up with a plague that is finally ended when Phineas drives a spear through an Israelite and his Midianite lover. Evidently impaling them while in the act. [UPDATE 3/7: Midianites are descendants of Abraham by his wife after Sarah. Gen. 25:1-2.]
Presumably the deal here is that Baal doesn't make the cut, but El (or YHWH not sure who adopted whom) did.
Also, I'd be remiss if I didn't know that the scene of a people celebrating a figure for murdering someone for inter-tribal marriage is pretty upsetting. It reminds me of the violent oppression of racial minorities in this country not so long ago. Nothing profound to say about it other that to identify it as awful.