Similarly, a prophet who violated his own prophetic instructions, and one who refrains from prophesying, are liable for death at the hand of God, since concerning the three of them, it is said, "I will seek [retribution] from him."
When a prophet - who has already proven himself to be a prophet - instructs us to violate one of the mitzvot of the Torah or many mitzvot, whether they be of a severe or light nature, for a limited amount of time, it is a mitzvah to listen to him.
The Sages of the early generation taught as part of the oral tradition: If a prophet tells you to violate the precepts of the Torah as Elijah did on Mount Carmel, listen to him with regard to all things except the worship of false gods. This applies when his command is temporary in nature.
For example, on Mount Carmel, Elijah offered a sacrifice outside [the Temple's premises], even though Jerusalem was chosen for such [service], and one who offers a sacrifice outside [the Temple's premises] is liable for karet. Since he was [already established as] a prophet, it was a mitzvah to listen to him. The commandment, "Listen to him," applies in these circumstances as well.
If they would have asked Elijah: How can we violate the Torah's command [Deuteronomy 12:13]: "[Be careful...] lest you offer your burnt offerings everywhere"?, he would have told them: We should not say anything, but anyone who offers a sacrifice outside [the Temple premises] is liable for karet, as Moses said. [The present instance,] however, [is an exception]. I am offering a sacrifice today outside [the Temple] at God's command in order to disprove the prophets of Ba'al.
Similarly, if any [other] prophet commands us to transgress for a limited time, it is a mitzvah to listen to him. If, however, he says that the mitzvah has been nullified forever, he is liable for execution by strangulation, for the Torah has told us: "[It is] for us and our children forever."