This question already has an answer here:
Why does Gandalf, during the siege of Gondor, imply that he cannot defeat the Black Captain because "not by the hand of man will he fall" ?
Isn't Gandalf not of mankind and thus not a man? Or does his incarnation qualify him as one?
Also, after the battle, Gandalf says that "The Captain of our foes is gone, but not without loss and bitter woe that I might have been able to prevent".
In summary: 1) Is Mithrandir a man? 2) Does Gandalf think that he can defeat the Black Captain, or not?
EDIT: clarification - part 2 is asking if Gandalf believes the prophecy applies to him, not if he actually can defeat the Witch-king.