Joshua 23 is the first of Joshua's two farewell speeches. After many days, when Yahweh had given rest to Israel from their enemies all around, and Joshua was old and well advanced in years, he called for all Israel's leaders. He pointed them back to God: You have seen all that Yahweh your God has done to all these nations because of you; for it is Yahweh your God who has fought for you.
The heart of the speech echoes chapter 1. Therefore be very courageous to keep and to do all that is written in the book of the law of Moses, that you not turn away from it to the right hand or to the left. He warned them not to join the remaining nations or serve their gods. If they did, those nations would become a snare and a trap to them. Instead, hold fast to Yahweh your God, as you have done to this day.
Joshua grounded his call in God's faithfulness. Behold, today I am going the way of all the earth. You know in all your hearts and in all your souls that not one thing has failed of all the good things which Yahweh your God spoke concerning you. So he urged, Take good heed therefore to yourselves, that you love Yahweh your God. In the New Testament, Jesus says, If you love me, keep my commandments (John 14:15).