Talmud, Bava Batra 3b and 4a as translated by https://www.sefaria.org.il/Bava_Batra.3b.16?lang=en&with=all&lang2=en
The Gemara asks: How could Bava ben Buta have advised Herod to raze the Temple and build another in its place, as will be described later? But doesn’t Rav Ḥisda say that a person must not demolish a synagogue unless he first builds another synagogue to take its place? The Gemara answers: If you wish, say that he saw cracks in the old Temple structure. And if you wish, say that actions taken by the government are different, as the government does not go back on its decisions. Therefore, there is no need to be concerned about negligence, as there is in the case of ordinary people. As Shmuel says: If the government says it will uproot mountains, it will uproot mountains and not retract its word. § The Gemara elaborates on the episode involving Bava ben Buta.
Herod was a slave in the house of the Hasmoneans. He set his eyes upon a certain young girl from the house of the Hasmoneans. One day that man, Herod, heard a Divine Voice that said: Any slave who rebels now will succeed. He rose up and killed all his masters, but spared that girl. When that girl saw that he wanted to marry her, she went up to the roof and raised her voice, and said: Whoever comes and says: I come from the house of the Hasmoneans, is a slave, since only that girl, i.e., I, remained from them. And that girl fell from the roof to the ground and died. It is related that Herod preserved the girl’s body in honey for seven years to prevent it from decaying. There are those who say that he engaged in necrophilia with her corpse and there are those who say he did not engage in necrophilia with her corpse. According to those who say he engaged in necrophilia with her corpse, the reason that he preserved her body was to gratify his carnal desires. And according to those who say he did not engage in necrophilia with her corpse, the reason that he preserved her body was so that people would say he married a king’s daughter.
Herod said to himself: Who expounds the verse: “One from among your brothers you shall set as king over you” (Deuteronomy 17:15) as meaning that he who is appointed as king must come from a Jewish family and cannot be an emancipated slave or a convert? It is the Sages who expound the verse in this manner, insisting that a king must have Jewish roots. He then rose up and killed all the Sages, but spared Bava ben Buta in order to take counsel with him.
Herod placed a garland made of porcupine hide on Bava ben Buta’s head, which pricked his eyes out. One day Herod came and sat before him without identifying himself in order to test him. He, Herod, said: See, Master, what this evil slave Herod is doing. Bava ben Buta said to him: What should I do to him? Herod said to him: The Master should curse him. Bava ben Buta said to him: But it is written: “Do not curse the king, not even in your thoughts” (Ecclesiastes 10:20). Herod said to him: He is not a king, since he rules illegally. Bava ben Buta said to him: And even if he were merely a rich man I would not curse him, as it is written: “And do not curse a rich person in your bedchamber” (Ecclesiastes 10:20). And even were he only a leader I would not curse him, as it is written: “And you shall not curse a leader among your people” (Exodus 22:27). Herod said to him: That halakha stated with regard to “a leader among your people,” that is, to a fit Jew who acts as a member of your people, i.e., in accordance with Torah law, and this one does not do the deeds of your people. Bava ben Buta said to him: Nevertheless, I am afraid of him. Herod said to him: There is nobody who will go and tell him, since you and I are sitting here alone. Bava ben Buta said to him: Nevertheless, it is written: “For a bird of the sky shall carry the sound, and that which has wings shall tell the matter” (Ecclesiastes 10:20).
Herod said to him: I am he. Had I known that the Sages were so cautious I would not have killed them. Now, what is that man’s remedy, i.e., what can I do to repent for my sinful actions? Bava ben Buta said to him: He who extinguished the light of the world by killing the Torah Sages, as it is written: “For the mitzva is a lamp, and the Torah is light” (Proverbs 6:23), should go and occupy himself with the light of the world, the Temple, as it is written with regard to the Temple: “And all the nations shall flow [venaharu] unto it” (Isaiah 2:2), the word venaharu alluding to light [nehora]. There are those who say that this is what he said to him: He who blinded the eye of the world, as it is written in reference to the Sages: “And if it be committed through ignorance by the eyes of the congregation” (Numbers 15:24), should go and occupy himself with the eye of the world, the Temple, as it is written: “I will desecrate my Temple, the pride of your strength, the delight of your eyes” (Ezekiel 24:21).
Herod said to him: I am afraid of the Roman government, that they will not permit me to make changes in the Temple. Bava ben Buta said to him: Send a messenger who will travel there for a year, and remain there for another year, and take yet another year to return. In the meantime, you can demolish the Temple and rebuild it. He did so. Eventually, they sent a message to Herod from Rome: If you have not yet demolished it, do not demolish it; and if you have already demolished it, do not rebuild it; and if you have demolished it and already rebuilt it, you shall be counted among those who act wickedly, seeking counsel only after they have already acted. Even if you are armed and in command of a military force, your book, i.e., your genealogical record, is here. You are neither a king [reikha] nor the son of a king, but rather Herod the slave who has made himself a freeman [kelonya]. The Gemara explains: What is the meaning of the word reikha? It denotes royalty, as it is written: “I am today a tender [rakh] and anointed king” (II Samuel 3:39). And if you wish, say that the meaning of the word is learned from here, from the term describing Joseph after he was appointed viceroy to the king: “And they cried before him, Avrekh” (Genesis 41:43).
The Sages say: One who has not seen Herod’s building has never seen a beautiful building in his life. The Gemara asks: With what did he build it? Rabba said: With stones of white and green marble [umarmara]. There are those who say that he built it with stones of blue, white, and green marble. Alternate rows of stones sent out an edge a bit and drew in an edge a bit, so that they would better receive and hold the plaster. He considered covering it with gold, but the Rabbis said to him: Leave it, and do not cover it, since it is more beautiful this way, as it looks like the waves of the sea.
The Gemara asks: And how did Bava ben Buta do this, i.e., give advice to Herod the wicked? But doesn’t Rav Yehuda say that Rav says, and some say it was Rabbi Yehoshua ben Levi who says: For what reason was Daniel punished? Because he offered advice to Nebuchadnezzar, as after sharing a harsh prophecy with him, it is stated: “Therefore, O king, let my counsel be acceptable to you, redeem your sins with charity and your iniquities with graciousness to the poor, that there may be a lengthening of your prosperity” (Daniel 4:24). And it is written: “All this came upon King Nebuchadnezzar” (Daniel 4:25). And it is written: “And at the end of twelve months” (Daniel 4:26). Only after a year was the prophecy fulfilled but not before that, apparently because Nebuchadnezzar heeded Daniel’s advice. The Gemara answers: If you wish, say that a slave like Herod is different since he is obligated in the mitzvot, and therefore Bava ben Buta had to help him repent. And if you wish, say the Temple is different, as without the help of the government it would not have been built.