One day as Mordecai was on duty at the palace, two of the king's eunuchs, Bigthana and Teresh -- who were guards at the door of the king's private quarters -- became angry at King Xerxes and plotted to assassinate him.
References for Esther 2:21
But Mordecai heard about the plot and passed the information on to Queen Esther. She then told the king about it and gave Mordecai credit for the report.
When an investigation was made and Mordecai's story was found to be true, the two men were hanged on a gallows. This was all duly recorded in The Book of the History of King Xerxes' Reign.
References for Esther 2:23