The people of Jerusalem made Ahaziah king in place of Jehoram. Ahaziah was Jehoram's youngest son. Robbers had come with the Arabs into Jehoram's camp. The robbers had killed all of his older sons. So Ahaziah, the king of Judah, began to rule. He was the son of Jehoram.
References for 2 Chronicles 22:1
Ahaziah was 22 years old when he became king. He ruled in Jerusalem for one year. His mother's name was Athaliah. She was a granddaughter of Omri.
Ahaziah also followed the ways of the royal family of Ahab. That's because Ahaziah's mother gave him bad advice. She told him to do what was wrong.
So he did what was evil in the sight of the Lord, just as the family of Ahab had done. After Ahaziah's father died, the members of Ahab's family became his advisers. That's what destroyed him.
He also followed their advice when he joined forces with Joram, the king of Israel. They went to war against Hazael at Ramoth Gilead. Joram was the son of Ahab. Hazael was king of Aram. The soldiers of Aram wounded Joram.
So he returned to Jezreel to give his wounds time to heal. His enemies had wounded him at Ramoth in his battle against Hazael, the king of Aram. Ahaziah, the son of Jehoram, went down to Jezreel. He went there to see Joram. That's because Joram had been wounded. Ahaziah was king of Judah. Joram was the son of Ahab.
Through Ahaziah's visit to Joram, God caused Ahaziah to fall from power. When Ahaziah arrived, he rode out with Joram to meet Jehu, the son of Nimshi. The LORD had anointed Jehu to destroy the royal family of Ahab.
So Jehu punished Ahab's family, just as the LORD had told him to. While he was doing it, he found the princes of Judah and the sons of Ahaziah's relatives. They had been serving Ahaziah. So Jehu killed them.
Then he went to look for Ahaziah. Jehu's men captured him while he was hiding in Samaria. Ahaziah was brought to Jehu and put to death. People buried his body, because they said, "He was a grandson of Jehoshaphat, who followed the LORD with all his heart." So no one in the royal family of Ahaziah was powerful enough to keep the kingdom.
Athaliah was Ahaziah's mother. She saw that her son was dead. So she began to wipe out the whole royal house of Judah.
References for 2 Chronicles 22:10
But Jehosheba went and got Joash, the son of Ahaziah. She was the daughter of King Jehoram. She stole Joash away from among the royal princes. All of them were about to be murdered. She put Joash and his nurse in a bedroom. Jehosheba, the daughter of King Jehoram, was the wife of the priest Jehoiada. She was also Ahaziah's sister. So Jehosheba hid the child from Athaliah. That's why Athaliah couldn't kill him.
The child remained hidden with the priest and his wife at God's temple for six years. Athaliah ruled over the land during that time.