The Book of Kings was written in Judah during the monolatrous period of the late monarchy and is consistently critical of the monarchy during the early monarchy. Each king of the former northern kingdom, Israel, was (correctly) described as worshipping more than one god, a practice that the Deuteronomist, author of Kings, viewed with abhorrence. Each Israelite king was somewhat euphemistically described as doing "that which was evil in the sight of the LORD" like each of his predecessors. We now know from archaeology and exegesis that Israel was a thoroughly polytheistic state.
2 Kings 17:20-22 is, from the Deuteronomist's perspective, a summary of everything wrong with the Israelite monarchy and the reference to Jeroboam is undoubtedly a reference to the legendary first king of the northern monarchy. By saying the "children of Israel walked in all the sins of Jeroboam, they are being accused of these sins from the very beginning: "they departed not from them.
" The Deuteronomist then implies in verse 23 that as a consequence of these sins, "the LORD removed Israel out of his sight ... So was Israel carried away out of their own land to Assyria unto this day."
The reference to 'sins' that included worshipping other gods, as well as child sacrifices and other sins that drove God to anger, as we read in verse 17:17:
2 Kings 17:19: And they caused their sons and their daughters to pass through the fire, and used divination and enchantments, and sold themselves to do evil in the sight of the LORD, to provoke him to anger.
Criticism of the early Judahite kings was more muted, but most kings were still condemned for polytheism, as we see in a preceding verse:
2 Kings 17:19: Also Judah kept not the commandments of the LORD their God, but walked in the statutes of Israel which they made.