2. He continued firm to his religion, and kept up his communion with God. (1.) God graciously appeared to him, v. 24. When the Philistines expelled him, forced him to remove from place to place, and gave him continual molestation, then God visited him, and gave him fresh assurances of his favour. Note, When men are found false and unkind, we may comfort ourselves that God is faithful and gracious; and his time to show himself so is when we are most disappointed in our expectations from men. When Isaac had come to Beer-sheba (v. 23) it is probable that it troubled him to think of his unsettled condition, and that he could not be suffered to stay long in a place; and, in the multitude of these thoughts within him, that same night that he came weary and uneasy to Beer-sheba God brought him his comforts to delight his soul. Probably he was apprehensive that the Philistines would not let him rest there: Fear not, says God to him, I am with thee, and will bless thee. Those may remove with comfort that are sure of God's presence with them wherever they go. (2.) He was not wanting in his returns of duty to God; for there he built an altar, and called upon the name of the Lord, v. 25. Note, [1.] Wherever we go, we must take our religion along with us. Probably Isaac's altars and his religious worship gave offence to the Philistines, and provoked them to be the more troublesome to him; yet he kept up his duty, whatever ill-will he might be exposed to by it. [2.] The comforts and encouragements God gives us by his word should excite and quicken us to every exercise of devotion by which God may be honoured and our intercourse with heaven maintained.