His going to Joram was God's occasion for Ahaziah's downfall; for when he arrived, he went out with Jehoram against Jehu the son of Nimshi, whom the Lord had anointed to cut off the house of Ahab.
And it happened, when Jehu was executing judgment on the house of Ahab, and found the princes of Judah and the sons of Ahaziah's brothers who served Ahaziah, that he killed them.
Then he searched for Ahaziah; and they caught him (he was hiding in Samaria), and brought him to Jehu. When they had killed him, they buried him, "because," they said, "he is the son of Jehoshaphat, who sought the Lord with all his heart." So the house of Ahaziah had no one to assume power over the kingdom.
Now when Athaliah the mother of Ahaziah saw that her son was dead, she arose and destroyed all the royal heirs of the house of Judah.
But Jehoshabeath, the daughter of the king, took Joash the son of Ahaziah, and stole him away from among the king's sons who were being murdered, and put him and his nurse in a bedroom. So Jehoshabeath, the daughter of King Jehoram, the wife of Jehoiada the priest (for she was the sister of Ahaziah), hid him from Athaliah so that she did not kill him.
And he was hidden with them in the house of God for six years, while Athaliah reigned over the land.