Joash also made himself into a god, as it is stated (II Chron. 24:17): "[Now] after the death of Jehoiada the priest, [the princes of Judah came and bowed low to the king]." They said to him: You are a god! Were you not a god, you would not have spent six years in the Holy of Holies. The High Priest would enter there only one time, and everyone would pray for him that he enter in peace; yet you spent six years there. Were you not a god, you would not have lived. At that time he accepted it from them, as it is stated (II Chron. 24:17, continued): "Then the king hearkened unto them." Immediately the Holy One made known to him that he was flesh and blood. What is written (II Chron. 24:24)? "So they inflicted judgments on Joash." Ergo (Ps. 9:21): "Let the nations know that they are only human. Selah."
Why King Joash Was Mistaken for a God in the Holy of Holies
Midrash Tanchuma Buber, Vaera 16:3
ויואש עשה עצמו אלוה, שנאמר (אחרי) [ואחרי] מות יהוידע (הכהן) (דה"ב כד יז), אמרו לו אלוה אתה, אילולי שאתה אלוה לא היתה עושה שש שנים בבית קודש הקדשים, כהן גדול לא היה נכנס אלא פעם אחת, והיו הכל מתפללים עליו שיכנס בשלום, ואתה עשית שם שש שנים, אילולי שאתה אלוה לא היתה חי, באותה שעה קיבל מהם, שנאמר אז שמע המלך אליהם (שם), מיד הודיעו הקב"ה שהוא בשר ודם, מה כתיב, ואת יואש עשו שפטים, (שם שם כד), הוי ידעו גוים אנוש המה סלה.