2 Kings 17:7

For so it was, that the children of Israel had sinned against the LORD their God, which had brought them up out of the land of Egypt, from under the hand of Pharaoh king of Egypt, and had feared other gods,

The verse means the children of Israel sinned against the Lord their God by fearing other gods, despite His having brought them up out of the land of Egypt from under the hand of Pharaoh king of Egypt. Their sin was rejecting God's ways for human and heathen ways, refusing to hear and leaving all His commandments, including His statutes and His covenant made with their fathers and His testimonies. Their idol worship included making molten images, even two calves, and making a grove, and worshiping all the host of heaven, and serving Baal, replacing the worship God had established. They also adopted heathen practices including polygamy, human sacrifice, and licentious rites. After gaining strength and uprightness through obedience under David, later kings became proud, took credit for the kingdom's greatness, and rebelled against God.

God sent plain warnings through all His servants the prophets foretelling the result and repeatedly called the people to repent, but they steadfastly refused to repent and would not hear. Rejecting God began Israel's downfall, which continued until the people became prey and subject to the nations whose practices they had chosen to follow. In anger the Lord afflicted them and delivered them into the hand of spoilers and enemies, who plundered the land. He finally cast them out of His sight, removing them from their land and carrying them away captive to Assyria, as foretold by the prophets.

This was the Assyrian capture of Samaria and scattering of the shattered remnant of the ten tribes among the nations during the earlier part of Hezekiah's reign. That Assyrian success led many to question the power of the God of the Hebrews and emboldened Nineveh, which had set aside the message of Jonah, in defiance against Heaven. A few years after the fall of Samaria the victorious Assyrian armies reappeared against the fenced cities of Judah, leaving it undecided until toward the close of Hezekiah's reign whether the gods of the heathen would finally prevail.