1 Kings 15:12

And he took away the sodomites out of the land, and removed all the idols that his fathers had made.

The verse belongs to the history of Judah and Israel stretching from the revolt of the ten tribes to the death of Jehoshaphat. Within that span it belongs specifically to the reign of Asa in Judah, which followed the reign of Abijah and stood alongside the reigns of Nadab, Baasha, Elah, Zimri, Omri and Ahab in Israel. It records that Asa removed the male cult prostitutes from the land and destroyed the idols made by his fathers, as his effort to reform Judah and turn it from idolatry. These reforms belong to Asa's better reign over Judah, a period of prosperity under his rule.

The wider account is one of apostasy in which kings led the nation away from worship of the living God toward idols. That setting contrasts worship of the Creator and the plan pointing to salvation from sin with worship of created things and degrading practices. In the account of these reigns idolatry stands together with the taking of temple and royal treasures as punishment for it.