'Dynasty' in the Bible
That's how Israel came to be in rebellion against David's dynasty to this day.
He lived like the kings of Israel, following the example of Ahab's dynasty, since he had married Ahab's daughter, and he practiced what the LORD considered to be evil.
Nevertheless, the Lord was unwilling to destroy David's dynasty because of the covenant that he had made with David, especially since he had promised to give him and to his sons the reigning presence of an heir forever.
"This is what the LORD God of your ancestor David says: "You haven't lived like your father Jehoshaphat and like King Asa of Judah. Instead, you have lived like the kings of Israel by causing Judah and the inhabitants of Jerusalem to commit cultic sexual immorality just like Ahab's dynasty did! And you've killed your brothers who were better than you your own father's dynasty!
He followed the example of Ahab's dynasty because his mother gave him evil counsel.
So he practiced what the LORD considered to be evil, just like Ahab's dynasty had done, because after his father died, he was given advice that resulted in his destruction.
God used Ahaziah's visit to Joram to destroy Ahaziah. As soon as he arrived, Ahaziah went out with Joram to attack Nimshi's son Jehu, whom the LORD had appointed to eliminate Ahab's dynasty.
And that's exactly what happened. While Jehu was punishing Ahab's dynasty, he located the princes of Judah and the sons of Ahaziah's brothers who were ministering to Ahaziah, and he put them to death.
But he sent messengers to him, who asked him, "What do we have in common, King of Judah? I am not here today opposing you. I am fighting the dynasty that is fighting me, and God has ordered me to hurry. For your own good, stop interfering with God, who is with me, and he won't destroy you!"