Batman: No. They must never know what he did.
This is the motivation to take a questionable action to preserve a person's legacy, and often to improve it, just a little bit.
The mission is over. The MacGuffin has been acquired, the Big Bad has been defeated, and the Hero is on his way home. Unfortunately, it is a bittersweet victory: Bob was killed during the mission, dying just in time for the Hero to hear his last words. Upon his return, the Hero meets Alice, who was very close to Bob, often a significant other, and must perform a Death Notification. She asks the hero what Bob's last words were. The hero, compassionate guy that he is, takes her hand, looks her in the eyes, and...
The hero has a good reason for doing this, however. At the end of his life, Bob did something that would tarnish his legacy. Maybe his last words were horrifying. Perhaps he did a Face–Heel Turn, or had to reluctantly betray the hero for some reason. Whatever the reason, telling Alice the truth would only result in damaging Bob's legacy, as well as hurting Alice by knocking down someone she held as a hero. Even if the hero has never told a lie up to that point, he will find it best to stretch the truth so that Bob can be remembered fondly. If this takes place at the end of the story, the hero will get away with it, but if the story goes on after the hero's lie then it will usually come back to bite him in the butt.
Note that this is the same trope whether the character outright lies or deliberately fails to mention the fact that would taint his friend's legacy. Also note, the Power of Legacy is used to defend a character's honor. If they lie/keep silent to shame the person in question, or to just prevent Alice from hearing his last words when they would actually help his legacy, that's just being a Jerk Ass.
Related to Never Speak Ill of the Dead. Let Them Die Happy is also related, except going in the opposite direction — lying to a dying character to ease their final moments. Compare Motivational Lie, where a lie is used to motivate a character to overcome an obstacle or challenge. Compare and contrast Rebuilt Pedestal, Warts and All, and Post-Mortem Conversion. May overlap with Treachery Cover Up. The inverse is the Deceased Fall-Guy Gambit, where a dead person is blamed for a crime or other actions that they didn't do. If the character being lied to ever finds out the truth, it may lead to them asking "Was It All a Lie?"
- In the Cowboy Bebop episode "Black Dog Serenade", Jet learns that Fad, his partner from the days when Jet was a cop, is a Corrupt Cop and was involved in the ambush that caused Jet to lose his arm. (In fact, Fad fired the shot that destroyed Jet's arm.) Events of the episode imply Fad has become a Death Seeking Atoner for his past misdeeds, and he all but commits suicide by getting into a gunfight with Jet while his revolver is mostly unloaded. The end of the episode subtly implies that Jet arranged the scene in a way so that it will look like Fad died a hero's death against the bad guys he and Jet were there to take down.
- Fullmetal Alchemist: In the end, the heroes have to whitewash Fuhrer Bradley's reputation and claim that he was an innocent victim of the coup d'etat. In reality Bradley was one of the ringleaders of a Government Conspiracy that very nearly annihilated the entire nation, but he was such a Villain with Good Publicity that the heroes feared revealing the truth would lead to civil unrest and rioting.
- Deconstructed, then averted in Preacher: When Jesse is hanging on to Cassidy from a plane, he tells Cassidy to tell Tulip he loves her, then orders him to let go. Cassidy then reveals himself by telling Tulip he couldn't hear what he said. But at the very end, Cassidy's goodbye letter explains to Tulip what Jesse had really told him.
- In the original Judas Contract arc of Teen Titans, the other Titans gave Terra a hero's funeral, a statue in their hall, and told everyone (including her half-brother, Geo-Force) that she died a hero. The truth was that she was The Mole and Evil All Along.
- Featured in the Astro City story "The Tarnished Angel." At the end of the story, the mastermind is unmasked as the disgraced former super-hero El Hombre, a Heroism Addict who staged Engineered Heroics in a bid to kill hundreds of villains for his return to the limelight. His complicity is covered up by other heroes, however, out of respect for his past valor.
- Crops up fairly frequently in Judge Dredd: two of the Chief Judges in history were Driven to Suicide, and in both cases the Judges went on to craft a more heroic end for them.
- At the end of Buck Godot: Zap Gun for Hire, Security Chief Parahexavoctal is revealed to have committed several large-scale crimes in pursuit of his assigned duty, including (but not limited to) genocide and the large-scale enslavement of a sentient race. When confronted with his sins, he continues to claim that he just did what he had to do. The Prime Mover acknowledges this, and decrees that his record shall stand unblemished. Par smiles and thanks him for fulfilling his ultimate wish, even as he is wiped from existence.
- How the Light Gets In viciously deconstructs Oliver's decision to reveal to the world that Laurel was the Black Canary (see Arrow below). As Sara points out, the authorities quickly looked into her husband to see if he was involved (vigilantism is illegal after-all) and if he had been charged as an accomplice, their daughter would have lost both of her parents. Furthermore, having her epitaph merely be Black Canary reduced her identity, saying nothing about her as a person, and the courts seriously consider throwing out every case she ever worked on as an ADA, considering the work to be tainted. Her friend Joanna decides to to dedicate her career to ensuring this doesn't happen, which is seen as actually preserving her legacy.
Sara: Do you know that there were people there who didn't even know she was married with a child? That's how intensely private she was. She worked her ass off to be able to separate her personal and professional lives and she did it to protect her daughter and her husband. You destroyed that protection at her own funeral. She wasn't even in the ground yet and you just stood up and thoughtlessly obliterated everything she had spent her entire life building. Her reputation, her career, her safety, her comfort. You invaded her privacy and you very nearly smashed Dean and Mary's lives to pieces.
- The Dark Knight: Batman takes the blame for Two-Face's actions, in order to keep Harvey Dent's "White Knight" reputation intact (and to make sure the criminals Harvey put behind bars stay there). There were other options, such as blaming the Joker, but those weren't brought up, and were slightly less airtight.
- The power is strong enough that years later during the events of The Dark Knight Rises Gotham celebrates Harvey Dent Day and crime rates are at an all-time low. Bane shatters the legacy by revealing the truth.
- In Star Wars: A New Hope, Obi-Wan tells Luke about his father, who Luke believes is dead. According to Obi-Wan, Luke's father was "the best star pilot in the galaxy, and a cunning warrior, and a good friend." Whether or not he's actually lying is up for debate (remember the scene between Luke and his ghost on Dagobah), but he does leave out telling Luke about how his father betrayed the Jedi council, crossed over to the dark side, helped kill all the Jedi, including children, etc. Luke remembers his father as a hero until the famous Luke, I Am Your Father scene.
- Over the course of L.A. Confidential, the main characters learn that the well known and widely respected Captain Dudley Smith of the Los Angeles Police has started setting himself up as a major organized crime figure, with the help of a number of current and former policemen. Dudley and his men are killed in a shootout with Detectives Edmund Exley and Bud White, but the Chief of Police and the D.A. know that such a scandal getting into news may destroy the police force. Dudley and his men are thus proclaimed to have died in a shootout with the mob and held up as heroes to the public.
- Subverted in a joke about a man whose father died at Auchwitz: he was drunk while on guard duty and fell off a watchtower.
- Probably the most famous example is from Joseph Conrad's Heart of Darkness, in which Kurtz's Famous Last Words were "The horror, the horror!" Marlow, however tells his fiancee that "His last words were... your name."
- In the Animorphs series the Andalite high command pressure Ax into doing this with his murdered older brother Elfangor upon learning he used his last minutes to give morphing power to humans. Ax reluctantly takes the blame so that the Andalite citizens can continue remembering his brother as a hero untainted by disgrace (the war against the Yeerks started when an Andalite gave tech to less-advanced species). It's a rare case, though, where the decision to do so clearly isn't liked by the main characters, who feel the Andalites over-enforce their Prime Directive law and because Ax has now been barred from advancing further in the military. He becomes enough of own hero in the end, allowing him to be promoted to prince.
- In The Amber Spyglass, the third book of the His Dark Materials trilogy, Lyra is kept asleep for the first two hundred pages. When she wakes up, she thinks that she may have caught some disease, and that Mrs. Coulter had been taking care of her. In reality, Mrs. Coulter had been drugging her. Will decided it would be better to let her keep the good memory, even if it was a lie.
- Wilfred Owen uses a combination of this trope and Exact Words in his war poem, S.I.W.
- Boromir's dying words are a confession: "I tried to take the Ring from Frodo. I am sorry. I have paid." Even when discussing where Frodo has gone, Aragorn refuses to tell the others this.
- In The Lost Fleet, The Alliance brass has intentionally used this to paint a mediocre ship commander's Last Stand as the most heroic act in history, turning "Black Jack" Geary into a Memetic Badass, using edited recordings of his last (and only) battle to underscore his greatness in order to inspire generations of fleet officers. Unfortunately, it ends up turning them into Glory Hounds with an Attack! Attack! Attack! mentality. This is partly done to account for the immense losses the Alliance takes during its century-long war with the Syndics, resulting in most of the knowledge of how fleets are supposed to fight, as well as what it means to be an Officer and a Gentleman, forgotten. By the time Geary is recovered from his Human Popsicle state, this average officer from the past turns out to be the best damn fleet commander the Alliance has. Unfortunately, he has a hard road ahead of him to get the ship commanders to change their mentality and fight the way they're supposed to, especially since they are rather disappointed that he doesn't fit their image of the great "Black Jack". When he finally returns the titular fleet to Alliance space, the brass refuses to believe that the fleet has fought all those battles and survived given Geary's relatively light losses, given how, in their minds, battles are "supposed to be" fought.
- Happens twice in Simon R. Green's first Hawk & Fisher novel: once when the Battle Couple Guards claim that The Renfield of a vampire they'd battled was just another victim, and again when they blame all the deaths at Gaunt's mansion on the guest who was secretly a werewolf. In the former case, it's to spare the feelings of the man's widow; in the latter, it's to preserve Adam Stalker's reputation as a hero Haven's people can look up to.
- In the Father Brown story "The Sign of the Broken Sword," Father Brown has this to say about a notable general who murdered the soldier who found evidence of his treachery and then led his troops on a suicide charge to effectively hide the body regarding the memorials raised to him:
Fr. Brown: You will never have done with him in England," said the priest, looking down, "while brass is strong and stone abides. His marble statues will erect the souls of proud, innocent boys for centuries, his village tomb will smell of loyalty as of lilies. Millions who never knew him shall love him like a father—this man whom the last few that knew him dealt with like dung. He shall be a saint; and the truth shall never be told of him, because I have made up my mind at last. There is so much good and evil in breaking secrets, that I put my conduct to a test. All these newspapers will perish; the anti-Brazil boom is already over; Olivier is already honoured everywhere. But I told myself that if anywhere, by name, in metal or marble that will endure like the pyramids, Colonel Clancy, or Captain Keith, or President Olivier, or any innocent man was wrongly blamed, then I would speak. If it were only that St. Clare was wrongly praised, I would be silent. And I will.
- In the final episode of Buffy the Vampire Slayer, Andrew tells Xander that Anya died saving his life, when all indications are she was merely killed during the Final Battle.
- Star Trek: The Original Series, 2nd pilot "Where No Man Has Gone Before". Gary Mitchell gains vast psionic powers and begins to think of himself as a god who regards humans as insects to be crushed. After Captain Kirk manages to kill him:
Kirk: "Captain's Log, stardate 1313.8. Add to official losses, Dr. Elizabeth Dehner. Be it noted she gave her life in performance of her duty. Lieutenant Commander Gary Mitchell. Same notation." (to Spock) I want his service record to end that way. He didn't ask for what happened to him.
- Likewise, in "The Doomsday Machine" Kirk states that his log will note that Commodore Decker died in the line of duty, omitting the part where the man pretty much went insane with survivor's guilt and almost got the crew of the Enterprise killed. It's heavily suggested that Kirk is attempting to imply by omission that Decker performed a Heroic Sacrifice by piloting the Constellation into the Doomsday Machine to destroy it, instead of the truth where he went out in a futile suicidal gesture by crashing into the machine with a shuttlecraft.
- The Power of Legacy is so strong, in fact, that Spock brings up logging Decker as having died in the line of duty, even though Decker constantly ignored his advice and put the Enterprise in mortal peril on multiple occasions. Not only is it so morally ambiguous that paladins can do it, but so can Vulcans.
- In Firefly, when Mal was about to kill Jayne for trying to sell the Tams to the feds, Jayne begged Mal to least not tell the others that he betrayed them. Fortunately for Jayne, his concern for how the others will remember him convinces Mal to give him another chance.
- Castle: Beckett decides to do this for Captain Montgomery, and the rest of the cast agrees.
- Ally does this for Billy after his death: she tells Georgia his Last Words were "Tell Georgia I love her", but he'd died in the midst of a tumor-induced hallucination:
Billy: "You see that woman?" (points to Ally) "I've been married to her for 12 years. And every day, when I go home to her... and our kids... it's everything."
- Stargate SG-1: O'Neill is forced to work with a former friend who's been in a sort of exile because of suspicions of Unfriendly Fire that killed a mutual friend of theirs. Turns out he had killed the other man on purpose, because that man was betraying them by signaling their position to the enemy. A variation, as he didn't care so much about the traitor's legacy as he did that the widow, who was also a friend, would lose her husband's pension. O'Neill offers to exonerate his friend with the brass.
- Played for Laughs on Arrested Development. Tobias paints himself blue and walks off to an audition for the Blue Man Group. Unfortunately, he's hit by a car and taken to the hospital. (In a variation on this trope, he lives.) At the hospital, it's revealed that Michael was the last person to see him before he left.
Lindsey: Did he say anything?
Tobias: [flashback] I just blue myself.
Michael: He said some wonderful things.
- On Blue Bloods, Danny tries but fails to talk a traumatized war veteran out of jumping off a rooftop. When he fills out his report on the incident, he claims the man had decided to come back to his family, but had slipped and fallen to his death accidentally. That way, at least the soldier's son can believe his father had intended to stay with him.
- While making a will on The Golden Girls, Rose claims she lost all the savings Charlie had built up during his life, even though this causes a rift between her and her daughter. In fact, Rose just didn't want her daughter to know her father was a business failure with nothing to leave to them.
- John Doe: The episode "John Deux" ends with John telling the estranged father of a deceased vagrant that he knew him from working at the same factory, and that "he wanted you to know that he made something of his life".
- Arrow: The episode "Canary Cry" has Laurel's legacy as the Black Canary as a major focus. Team Arrow fears that Evelyn's actions in Laurel's costume will leave the Black Canary remembered as nothing but a murderer. To make sure that both Laurel and her secret identity get the legacy they deserve, Oliver reveals that Laurel was the Black Canary at her funeral, causing her to be remembered as the hero she truly was. Laurel's epitaph even reads "The Black Canary" as a reflection of this.
- In Chicago P.D. episode "Fallen" police sergeant McGrady is killed in the line of duty while investigating a drug dealer for murdering three people. It then turns out McGrady was stealing from a police-backed charity to fuel/pay for his gambling habits, and he framed the drug dealer for his suicide. His apparent death in the line of duty closes the investigation into him, sees the drug dealer arrested for his murder (they couldn't prove he was guilty for the others), and guarantees his family collects his pension. Despite being disgusted at the thought of him being thought of as a hero Voight and Upton decide to allow it, both to ensure his family is provided for and it is the only way the drug dealer will face justice, even if it is for something he's innocent of.
- Outright invoked on One Tree Hill episode "Danny Boy," when Haley promises a dying Dan Scott that she will spare her daughter Lydia (Dan's granddaughter, who is barely a year old) the details of all the horrible things that Dan has done over the years (such as neglecting his oldest son Lucas, emotionally abusing his younger son Nathan, tormenting BOTH his sons' mothers AND killing his own younger brother), and instead choosing to tell her how much Dan loved his grandchildren as gratitude for saving her husband's life (the aforementioned emotionally abused son).
- Happens at the end of act IV or Cyrano de Bergerac. Roxanne thinks Christian is a brilliant poet and has fallen in love with his words, but actually Cyrano has been writing all his letters for him. When Christian realizes Roxanne is unknowingly in love with Cyrano's writing rather than himself, he tells Cyrano to tell her the truth and charges into battle. Cyrano is about to tell her the truth when Christian is brought back mortally wounded, so Cyrano omits the truth, letting Roxanne continue to believe that Christian was the brilliant writer she thought he was and never deceived her or pretended talents he didn't have (until Cyrano himself is mortally wounded years later and goes to see her and she figures out the truth).
- At the end of Metal Gear Solid, Snake gives a rather generic speech about how Grey Fox had wished the best for Naomi, who Fox had practically been a big brother to. Snake decides to skip the part where Grey Fox confessed that he had been the one who had killed Naomi's parents. The way Snake probably sees it, telling Naomi how much Grey Fox really did care for her was more important.
- One of the quotes in Sid Meier’s Alpha Centauri.
Richard Baxton piloted his Recon Rover into a fungal vortex and held off four waves of mind worms, saving an entire colony. We immediately purchased his identity manifests and repackaged him into the Recon Rover Rick character with a multi-tiered media campaign: televids, touchbooks, holos, psi-tours—the works. People need heroes. They don't need to know how he died clawing his eyes out, screaming for mercy. The real story would just hurt sales, and dampen the spirits of our customers.
- In Dragon Age: Origins, the Warden is asked by Ruck's mother to find her son in the Deep Roads, where he's been missing for two years and assumed dead. While the Warden finds him alive, he's been turned into a half-crazed Ghoul as a result of the being infected with the Taint either by constant exposure or consuming Darkspawn flesh to survive. The Warden has the option to agree to his request to tell his mother that they found his body in the Deep Roads, letting her believe he died a hero.
- In Sacrifice, the ending for Persephone/James' sees Eldred omit the fact that Mithras was a guise of Marduk and instead claim Mithras made a Heroic Sacrifice and should be remembered as a hero for telling the truth.
- In Umineko: When They Cry, the late arcs reveal that there are at least two characters who invoke this. On one side Eva, the (not quite) Sole Survivor of the Rokkenjima massacre, blew up the island to erase what happened and hid the truth to Ange, at the cost of being herself painted as the culprit in the future. Ange eventually learns of the real culprits, and it drives her to suicide, heavily implying that it was her own parents. On the other side after her initial plan went horribly wrong, Beatrice paints herself as a cruel witch and claims to have committed the murders so that the memory of the family wouldn't be tainted. However she wanted at least Battler to know the truth and understand her.
- In the Trope Naming example from Dominic Deegan, the person they were talking about had challenged Donovan to a duel over Donovan's wife just before jumping into a portal to Hell. Later, at the end of that story arc, Dominic invokes this when recounting Siegfried's death. Using his second sight, he had seen that Siegfried had held a genocidal campaign against orcs since boyhood, and is now in hell, but just before going to Hell he punched out all of Dominic's teeth. When Milov or Jayden ask how their friend died, Dominic's epitaph paints the knight in a much more heroic light. It comes back to bite him.
- On this page of Jack, Lieutenant Bullock recounts how he told a fellow soldier's parents that their son died while pulling wounded men out of a fire. What really happened... well, it wasn't quite as dignified, involving a poor choice of place to take a dump and a landmine.
- In The Order of the Stick, O-Chul accepts responsibility for destroying the gate to protect the already-tarnished-enough legacy of Well-Intentioned Extremist/Knight Templar Miko Miyazaki.
- In an episode of Rick and Morty, the pair travel to a fantasy world where Morty is attack by a pedophile. Rick later kills the guy, who turns out to have been a beloved local king. Afterwards several of the King's officials find evidence of what the king was doing, but decide to Destroy the Evidence so the King will continue being an inspiration to the people.