Joshua 23:3

And ye have seen all that the LORD your God hath done unto all these nations because of you; for the LORD your God is he that hath fought for you.

This belongs to Joshua's farewell address, delivered after Israel's wars of conquest had ended and the people had enjoyed a long period of rest, when he called all Israel with its leaders together to speak to them. They had seen with their own eyes that the Lord their God had fought for them and had subdued and defeated the nations of Canaan on their behalf. The nations were defeated because the Lord fought for Israel, not because Joshua or the people could claim the victory for themselves, so God alone deserved the glory for bringing them into the land.

Although the Canaanites had been subdued, much of the promised land still remained to be possessed, so the reminder was meant to keep Israel from becoming complacent and from abandoning the command to drive out the remaining idolatrous peoples. The Lord Himself would expel those remaining nations and give Israel their land as He had promised. In response the people were to be courageous and to obey the law of Moses without turning aside from it.

Joshua's review of God's providence was meant to awaken gratitude for His care and to humble the people over their murmurings and failure to follow His revealed will. The lesson was applied in a warning against idolatry, against intermarriage with idolaters, and against even approaching sin, showing that departing from God brings desolation, for the Lord is faithful both to fulfill His promises and to carry out His warnings.