2 Chron 22:7-12 Through Ahaziah's visit to Joram, God brought about Ahaziah's downfall. When Ahaziah arrived, he went out with Joram to meet Jehu son of Nimshi, whom the Lord had anointed to destroy the house of Ahab. While Jehu was executing judgment on the house of Ahab, he found the princes of Judah and the sons of Ahaziah's relatives, who had been attending Ahaziah, and he killed them. He then went in search of Ahaziah, and his men captured him while he was hiding in Samaria. He was brought to Jehu and put to death... When Athaliah the mother of Ahaziah saw that her son was dead, she proceeded to destroy the whole royal family of the house of Judah. But Jehosheba, the daughter of King Jehoram, took Joash son of Ahaziah and stole him away from among the royal princes who were about to be murdered and put him and his nurse in a bedroom. Because Jehosheba, the daughter of King Jehoram and wife of the priest Jehoiada, was Ahaziah's sister, she hid the child from Athaliah so she could not kill him. He remained hidden with them at the temple of God for six years while Athaliah ruled the land.
2 Chron 23:12-15 When Athaliah heard the noise of the people running and cheering the king, she went to them at the temple of the Lord. She looked, and there was the king, standing by his pillar at the entrance. The officers and the trumpeters were beside the king, and all the people of the land were rejoicing and blowing trumpets, and singers with musical instruments were leading the praises. Then Athaliah tore her robes and shouted, "Treason! Treason!" Jehoiada the priest sent out the commanders of units of a hundred, who were in charge of the troops, and said to them: "Bring her out between the ranks and put to the sword anyone who follows her." For the priest had said, "Do not put her to death at the temple of the Lord." So they seized her as she reached the entrance of the Horse Gate on the palace grounds, and there they put her to death.
Despite having a godly father Jehoshaphat, Jehoram turned out to be diametrically opposite to his father: he was more concerned about power and position than about mercy and justice. His first act upon ascending the throne was to eliminate all competition to his throne: he murdered all his six brothers. He also married a daughter of Ahab and followed her Baal worship. However, the Lord was unwilling to wipe out David's descendants because He has made a covenantal promise to David to keep a royal lineage among his descendants forever. Nevertheless, Jehoram would die a painful death from a disease of the bowel. He died "to no one's regret, and was buried in the City of David, but not in the tombs of the kings" (2 Chron 21:20).
His son Ahaziah who succeeded him was no better. He was killed together with the northern king Joram when Israel's general Jehu was executing the judgment of God against the house of Ahab. When Ahaziah's mother Athaliah realised her son was dead, she usurped the throne in Jerusalem and slaughtered all members of the royal household. But one escaped, viz., Joash, who was still a baby then. Six years later, Jehoida the priest crowned and installed this young boy as the king of Judah. When Athaliah heard of it, she cried out, "Treason! Treason!" Jehoida's commanders were sent to capture and kill her.
The only light in the midst of this dark tunnel of power struggles and palace intrigues is this verse 2 Chron 21:7, "Nevertheless, because of the covenant the Lord had made with David, the Lord was not willing to destroy the house of David. He had promised to maintain a lamp for him and his descendants forever." When God made a promise, he does not retract it, even when His people are unfaithful. The basis of God's faithfulness is not based on how we perform, but on His faithfulness to His covenant He made. In the OT, his faithfulness is based on His covenant of David and in the NT, his faithfulness is based on His covenant of Christ.
That is why Jesus tells us to pray "in my name", meaning that God's faithfulness to his promise of prayer is not based on our behaviour and conduct but based on the covenant He made because of what Christ has done for us. So, never for a moment doubts that God will not fulfill his promise because our conduct is not up to mark. God has chosen to "blessed us with every spiritual blessing in Christ" (Ephesians 1:3). That is always the basis for His blessing -- it's always about Jesus Christ, never about us.
Father, we thank You that though we are unfaithful, You have remained faithful to Your covenant because the new covenant we have is ratified at the Cross by the Blood of Christ. Amen.