Before Abraham concluded the covenant with Abimelech, king of the Philistines, he reproved him on account of a well, for "Correction leads to love," and "There is no peace without correction." The herdmen of Abraham and those of Abimelech had left their dispute about the well to decision by ordeal: the well was to belong to the party for whose sheep the waters would rise so that they could drink of them.

But the shepherds of Abimelech disregarded the agreement, and they wrested the well for their own use. As a witness and a perpetual sign that the well belonged to him, Abraham set aside seven sheep, corresponding to the seven Noachian laws binding upon all men alike. But God said, "Thou didst give him seven sheep. As thou livest, the Philistines shall one day slay seven righteous men, Samson, Hophni, Phinehas, and Saul with his three sons, and they will destroy seven holy places, and they will keep the holy Ark in their country as booty of war for a period of seven months, and furthermore only the seventh generation of thy descendants will be able to rejoice in the possession of the land promised to them."

After concluding the alliance with Abimelech, who acknowledged Abraham's right upon the well, Abraham called the place Beer-sheba, because there they swore both of them unto a covenant of friendship.