God sent prophets to straighten them out, warning of judgment. But nobody paid attention.
Then the Spirit of God moved Zechariah son of Jehoiada the priest to speak up: "God's word: Why have you deliberately walked away from God's commandments? You can't live this way! If you walk out on God, he'll walk out on you."
But they worked out a plot against Zechariah, and with the complicity of the king - he actually gave the order! - they murdered him, pelting him with rocks, right in the court of The Temple of God.
That's the thanks King Joash showed the loyal Jehoiada, the priest who had made him king. He murdered Jehoiada's son. Zechariah's last words were, "Look, God! Make them pay for this!"
A year or so later Aramean troops attacked Joash. They invaded Judah and Jerusalem, massacred the leaders, and shipped all their plunder back to the king in Damascus.
The Aramean army was quite small, but God used them to wipe out Joash's large army - their punishment for deserting God, the God of their ancestors. Arameans implemented God's judgment against Joash.
They left Joash badly wounded and his own servants finished him off - it was a palace conspiracy, avenging the murder of the son of Jehoiada the priest. They killed him in his bed. Afterward they buried him in the City of David, but he was not honored with a grave in the royal cemetery.