"Shooting the messenger" is a metaphoric phrase used to describe the act of blaming the bearer of bad news.
Until the advent of modern telecommunication, messages were usually delivered by human envoys. For example, in war, a messenger would be sent from one camp to another. If the message was unfitting, the receiver might blame the messenger for such bad news and take their anger out on them.
"Shooting the messenger" is a subdivision of the ad hominem logical fallacy.
An analogy of the phrase can come from the breaching of an unwritten code of conduct in war, in which a commanding officer was expected to receive and send back emissaries or diplomatic envoys sent by the enemy unharmed. During the early Warring States period of China, the concept of chivalry and virtue prevented the executions of messengers sent by opposing sides.
An early literary citing of "shooting the messenger" is in Plutarch's Lives states: "The first messenger, that gave notice of Lucullus' coming was so far from pleasing Tigranes that, he had his head cut off for his pains; and no man dared to bring further information. Without any intelligence at all, Tigranes sat while war was already blazing around him, giving ear only to those who flattered him".
A related sentiment was expressed in Antigone by Sophocles as "no one loves the messenger who brings bad news" or "no man delights in the bearer of bad news" (Greek: στέργει γὰρ οὐδεὶς ἄγγελον κακῶν ἐπῶν).
The sentiment that one should not shoot the messenger was expressed by Shakespeare in Henry IV, Part 2 (1598) and in Antony and Cleopatra: Cleopatra threatens to treat the messenger's eyes as balls when told Antony has married another, eliciting the response "Gracious madam, I that do bring the news made not the match."