2 Kings 11:1-8 ESV
Now when Athaliah the mother of Ahaziah saw that her son was dead, she arose and destroyed all the royal family. But Jehosheba, the daughter of King Joram, sister of Ahaziah, took Joash the son of Ahaziah and stole him away from among the king’s sons who were being put to death, and she put him and his nurse in a bedroom. Thus they hid him from Athaliah, so that he was not put to death. And he remained with her six years, hidden in the house of the LORD, while Athaliah reigned over the land.
But in the seventh year Jehoiada sent and brought the captains of the Carites and of the guards, and had them come to him in the house of the LORD. And he made a covenant with them and put them under oath in the house of the LORD, and he showed them the king’s son. And he commanded them, “This is the thing that you shall do: one third of you, those who come off duty on the Sabbath and guard the king’s house (another third being at the gate Sur and a third at the gate behind the guards) shall guard the palace. And the two divisions of you, which come on duty in force on the Sabbath and guard the house of the LORD on behalf of the king, shall surround the king, each with his weapons in his hand. And whoever approaches the ranks is to be put to death. Be with the king when he goes out and when he comes in.”
ESV: English Standard Version 2016