One of the things to keep in mind is the passing of different dynasties in the stories of the kings. A “dynasty” is a succession of rulers in the same family.
Thus far, the northern kingdom of Israel has had four different dynasties. It has been ruled by Jeroboam and his family, Baasha and his family, Zimri (short dynasty of seven days), and Omri. With the revolt of Jehu, we enter the fifth dynasty. All of these previous dynasties have come to an end because the rulers have been unfaithful to God. In each case but that of Zimri, a prophet has foretold of the end of the dynasty.
On the other hand, only one dynasty has ruled Judah: that of the house of David and in 2 Kings 11, that dynasty comes perilously close to extinction. With the death of Ahaziah, his mother, Athaliah, sets out to destroy her entire family.
Why would she do this?
We are left to speculate. Perhaps she intended to seize the kingdom for herself (she does, after all, rule Judah for six years). But also remember that she is a granddaughter of Omri, the founder of the fourth dynasty of Israel. Perhaps she was seeking to become the link that would rejoin the kingdoms again.
Whatever the reasoning, her plans were foiled. Ahaziah’s sister, Jehosheba was married to a Levitical priest by the name of Jehoiada. She kidnapped Ahaziah’s newborn son (Joash) and hid him in a store room in the temple of Solomon. He was kept there secretly for seven years.
At the end of seven years, the priest Jehoiada revealed him to the royal guard. The Carites (also known as the Kerethites) and staged a coup to declare the boy as king. The Davidic dynasty had hung by a thread, but the Lord’s promise held sure and David’s line was preserved. Thanks also to the priest Jehoiada, Joash was raised to be faithful to the Lord and the priest’s guidance led to a renewal of the covenant of God and a spiritual revival in Judah.