There was a famine in the country -- different from the previous famine which took place in the time of Abraham -- and Isaac went to Abimelech, the Philistine king at Gerar.
Yahweh had appeared to him and said, 'Do not go down to Egypt; stay in the country which I shall point out to you.
Remain for the present in that country; I shall be with you and bless you, for I shall give all these countries to you and your descendants in fulfilment of the oath I swore to your father Abraham.
I shall make your descendants as numerous as the stars of heaven, and I shall give them all these countries, and all nations on earth will bless themselves by your descendants
in return for Abraham's obedience; for he kept my charge, my commandments, my statutes and my laws.'
So Isaac stayed at Gerar.
When the people of the place asked him about his wife he replied, 'She is my sister,' for he was afraid to say, 'She is my wife,' thinking, 'The people of the place will kill me because of Rebekah, since she is beautiful.'
When he had been there some time, Abimelech the Philistine king happened to look out of the window and saw Isaac fondling his wife Rebekah.
Abimelech summoned Isaac and said to him, 'Surely she must be your wife! How could you have said, "She is my sister"?' Isaac replied, 'Because I thought I might be killed on her account.'
Abimelech said, 'What a thing to do to us! One of the people might easily have slept with your wife. We should have incurred guilt, thanks to you.'
Then Abimelech issued this order to all the people: 'Whoever touches this man or his wife will be put to death.'
Isaac sowed his crops in that country, and that year he reaped a hundredfold. Yahweh blessed him
and the man became rich; he prospered more and more until he was very rich indeed.
He acquired flocks and herds and a large retinue. The Philistines began to envy him.
The Philistines had blocked up all the wells dug by his father's servants -- in the days of his father Abraham -- filling them in with earth.
Then Abimelech said to Isaac, 'You must leave us, for you have become much more powerful than we are.'
So Isaac left; he pitched camp in the Valley of Gerar and there he stayed.
Isaac reopened the wells dug by the servants of his father Abraham and blocked up by the Philistines after Abraham's death, and he gave them the same names as his father had given them.
But when Isaac's servants, digging in the valley, found a well of spring-water there,
the herdsmen of Gerar disputed it with Isaac's herdsmen, saying, 'That water is ours!' So Isaac named the well Esek, because they had disputed with him.
They dug another well, and there was a dispute over that one too; so he named it Sitnah.
Then he left there, and dug another well, and since there was no dispute over this one, he named it Rehoboth, saying, 'Now Yahweh has made room for us to thrive in the country.'
From there he went up to Beersheba.
Yahweh appeared to him the same night and said: I am the God of your father Abraham. Do not be afraid, for I am with you. I shall bless you and multiply your offspring for my servant Abraham's sake.
There he built an altar and invoked the name of Yahweh. There he pitched his tent, and there Isaac's servants sank a well.
Abimelech came from Gerar to see him, with Ahuzzath his adviser and Phicol the commander of his army.
Isaac said to them, 'Why do you come to me since you hate me, and have made me leave you?'
'It became clear to us that Yahweh was with you,' they replied, 'and so we thought, "It is time to have a treaty sworn between us, between us and you." So let us make a covenant with you:
that you will not do us any harm, since we never molested you but were unfailingly kind to you and let you go away in peace. Henceforth, Yahweh's blessing on you!'
He then made them a feast and they ate and drank.
Early next morning, they exchanged oaths. Then Isaac bade them farewell and they left him as friends.
It happened, the same day, that Isaac's servants brought him news about the well they had been digging. 'We have found water!' they said to him.
So he called the well Sheba, and hence the town is named Beersheba to this day.
When Esau was forty years old he married Judith daughter of Beeri the Hittite, and Basemath daughter of Elon the Hittite.
These were a bitter disappointment to Isaac and Rebekah.