"all the places where the nations worshipped, etc.": Scripture here apprises us that the Canaanites were even more steeped in licentiousness than the Babylonians.

"which you inherit": Do not emulate their (evil) ways lest others come and disinherit you.

R. Yossi Haglili says: I might think that even if they worshipped the mountains and the hills you were commanded to destroy them; it is, therefore, written "their gods on the high mountains, and on the hills, and under every leafy tree — "their gods on the mountains," but the mountains (themselves) are not (considered) their gods. And, likewise, for the hills and for the leafy trees. R. Akiva said: Before you said this, I would expound it before you (as meaning that) wherever you find a high mountain or a hill or a leafy tree know that there is idolatry (i.e., idolatrous images) there (and seek them out to destroy them). This is the intent of "on the high mountains, and on the hills, and under every leafy tree."