As soon as King Ahaziah's mother Athaliah learned of her son's murder, she gave orders for all the members of the royal family to be killed.
Only Ahaziah's son Joash escaped. He was about to be killed with the others, but was rescued by his aunt Jehosheba, who was King Jehoram's daughter and Ahaziah's half sister. She took him and his nurse into a bedroom in the Temple and hid him from Athaliah, so that he was not killed.
For six years Jehosheba took care of the boy and kept him hidden in the Temple, while Athaliah ruled as queen.