Rudy Giuliani's appointment to President Donald Trump's ever-changing legal team in the special counsel's probe couldn't have come at a more intriguing time.

The former New York mayor also emerges as a key figure in former FBI Director James Comey's new, best-selling memoir, "A Higher Loyalty," which was released this week — and it doesn't reflect well on Giuliani.

In the book, Comey, who worked as an assistant U.S. attorney under Giuliani during the late 1980s in Manhattan, likens his former boss to an "emperor" who lacked humility and always sought the media spotlight.

Giuliani cut a brash, dynamic figure across the city scene then, his office helping to systematically dismantle organized crime families. Eventually, that persona would propel Giuliani to City Hall, where he served two terms as mayor and saw his national profile rise due to his widely praised response to the Sept. 11, 2001, terrorist attacks.

Comey worked on several high-profile cases under Giuliani. At first, he writes, he was "especially pumped" to meet Giuliani, who stopped by the office to give him a "pep talk" about finding a possible federal angle in a New York state case against civil rights leader Al Sharpton. But that impression of Giuliani didn't last for Comey.

"It took me a while to realize that Giuliani's confidence was not leavened with a whole lot of humility," the former FBI director writes. "The cost of that imbalance was that there was very little oxygen left for others."

Comey also writes:

Though Giuliani's confidence was exciting, it fed an imperial style that severely narrowed the circle of people with whom he interacted, something I didn't realize was dangerous until much later: a leader needs the truth, but an emperor does not consistently hear it from his underlings.

The Comey-Giuliani-Trump story line took yet another dramatic twist Thursday night, when Comey joined MSNBC's Rachel Maddow to talk about his book and his memos about Trump, which were leaked to the media.

In the interview, Maddow played clips of Giuliani, a top Trump campaign surrogate, apparently boasting on television during the latter days of the 2016 race about big news coming down the pike that could be bad for Democratic nominee Hillary Clinton. It appears he was talking about new developments in the investigation over Clinton's email server, which would result in Comey re-opening the probe days before the election.

Comey told Maddow that he was aware of Giuliani's boasts and, in turn, ordered an investigation into the matter. He said he didn't know how it turned out, however, since Trump fired him last May, before he had a chance to see the matter through.

The renewed Clinton email investigation turned up no evidence of wrongdoing on the candidate's behalf, but Comey critics say his move helped Trump win the election.