I was debating with a chavruta today how to understand the following explanation from Metzudat David. The verse in Nechemiah 6:12 says:
"Then I realized that it was not God who sent him, but that he uttered that prophecy about me—Tobiah and Sanballat having hired him."
The question the commentaries attempt to answer is: How did Nechemiah figure out that Shema'ayah was being paid by Tovia and Sanbalat?
Metzudat David wrote:
"כי הנבואה. כי אמר אשר הנבואה דבר עלי ללכת אל ההיכל והנה הרבה ריוח והצלה לפניו ומדוע א״כ יצוה לעבור מצותו כי אם אמרו מדעתו היה מקום לומר מפני פיקוח נפש הותר הדבר אבל ה׳ לא יצוה כזאת ובזה הכרתי שאין עצתו אמונה רק טוביה או סנבלט שכרו להכשיל אותי בעצתו."
Translation: "that prophecy. For he said, the prophecy he spoke to me to go to the sanctuary, for after all, there is much providence before Him, and if so, why would He command to desecrate His commandment, and if he said it from himself, there was room to say that because it is necessary for saving a life, it is allowed, but Hashem would not command so, and through this I realized that his advice is not trustworthy but that he was being paid by Tovia or Sanbalat to trick me through his advice."
I understood the M"D to be saying that Nechemiah thought there were two options: Either Hashem would speak through one of his prophets, Shema'ayah in this case, and tell Nechemiah not to be afraid, or Shema'ayah would tell him: "Here's my advice: since this is a case of pikuach nefesh, you should go hide in the sanctuary of the Temple, where none but the kohanim are allowed." According to Nechemiah, the combination of seemingly Hashem having said through Shema'ayah that he should go hide in the Temple because it's pikuach nefesh and therefore, as a one-time thing, is allowed - was impossible, because Hashem Himself would not command a desecration of the Torah, even to save a life (rather, He would save Nechemiah some other way, as He has no shortage of ways to do so).
From this I gathered that any hora'at sha'ah, at least according to M"D, comes solely from the prophet himself and not commanded by Hashem. My friend disagreed with me. He thought there's no way that a prophet can command a hora'at sha'ah from himself, but rather, that it must come from Hashem. He doesn't know, however, how to explain the Metzudat David.
What's the correct understanding of the Metzudat David?