King Herod, who married Miriam the Hasmonean, was a slave in the Hasmonean household. Upon hearing a prophesy that advised any slave that this was a propitious time to rebel, he rose up and killed all the members of the family leaving only Miriam, who climbed to the top of a building and announced that anyone who claimed to be a member of the Hasmonean dynasty was admitting that he was a slave, since everyone from the family had been killed.
Herod blamed the Rabbinic Sages for his difficult situation, since they were the ones who interpreted the passage in Sefer Devarim (17:15) to limit the position of king only to someone from a Jewish family, and not a convert or a freed slave. He therefore killed all of the Sages, leaving alive only Bava ben Buta who he wanted to serve as an advisor; nevertheless, he blinded him. The Gemara describes how Herod approached the blind Sage and tried to goad him into speaking badly of the king. Refusing to take the bait, Bava ben Buta quoted pesukim such as ve-nasi be-amkha lo ta-or (Shemot 22:27), which forbid anyone from cursing the king.
This conversation led Herod to announce himself to the Sage, and to beg him for direction towards repentance for having killed the Sages. Bava ben Buta recommended replacing the deteriorating Temple, and offered advice on how to avoid the wrath of the Roman government under whom Judea lived.
Bava ban Buta was one of the students of Shammai HaZaken, although his rulings followed Hillel in important cases. He was well known in Jerusalem for his piety and modesty and particularly how he was willing to forgo his honor in cases where it would bring peace to a home or would further the honor of God. In Josephus the story is told that Shammai prophesized to Herod that he would become king, which may be another reason why his student, Bava, was spared.