Arcana Coelestia # 9317
9317. 'You shall not bow down to their gods' means that falsities arising from evil must not be worshipped. This is clear from the meaning of 'bowing down' as adoration and worship, dealt with in 4689; and from the meaning of 'the gods of the nations' as falsities arising from evil, dealt with in 4544, 7873, 8867, 9283. Falsities arising from evil are worshipped when worship is performed in accord with teachings concocted out of falsified truths and adulterated forms of good. This happens when dominion and gain are thought of as the end in view, and truths from the Word as the means.
Arcana Coelestia # 4544
4544. 'Remove the gods of the foreigner which are in the midst of you' means that falsities were to be cast aside. This is clear from the meaning of 'removing' as casting aside, and from the meaning of 'the gods of the foreigner' as falsities; for in the Word 'gods' means truths and in the contrary sense falsities, 4402. Those people were called 'foreigners' who were outside the Church and therefore those who were subject to falsities and evils, 2049, 2115; and this explains why 'the gods of the foreigner' means falsities.