The Israelites come to the oasis of Kadesh Barnea, where Miriam dies and the Israelites remain for forty years. The people are without water, so Yahweh commands Moses to get water from a rock by speaking to it, but Moses strikes the rock with his staff instead, for which Yahweh forbids him from entering the promised land. Moses sends a messenger to the king of Edom requesting passage through his land to Canaan, but the king refuses. The Israelites then go to Mount Hor, where Aaron dies. The Israelites try to go around Edom, but the Israelites complain about lack of bread and water, so Yahweh sends a plague of poisonous snakes to afflict them. After Moses prays for deliverance, Yahweh has him create the brazen serpent, and the Israelites who look at it are cured. The Israelites are soon in conflict with various other kingdoms, and king Balak of Moab attempts to have the seer Balaam curse the Israelites, but Balaam blesses the Israelites instead. Some Israelites begin having sexual relations with Moabite women and worshipping Moabite gods, so Yahweh orders Moses to impale the idolators and sends a plague, but the full extent of Yahweh's wrath is averted when Phinehas impales an Israelite and a Midianite woman having intercourse (Numbers 25:7-9). Yahweh commands the Israelites to destroy the Midianites and Moses and Phinehas take another census. They then conquer the lands of Og and Sihon in Transjordan, settling the Gadites, Reubenites, and half the Tribe of Manasseh there.