Give the Villain a Hero's Funeral

He was evil, by the lights of the protagonist; he was defeated, and now he's dead.

However, he was famous, in a highly-placed position, or somebody influential trusted him. If the general public finds out he was a villain, then his family will suffer or his employers will go out of business.

There's no choice. So that innocent people do not suffer (or to protect the reputations of the people in charge, in more cynical works), the higher-ups have no option but to Give the Villain a Hero's Funeral. The protagonist is rarely happy with this decision, but usually understands why it had to be made.

This is a subtrope of both Never Speak Ill of the Dead and Treachery Cover-Up. Compare with The Power of Legacy, where people are mislead for the deceased's protection or the people he betrayed aren't ready to tell anyone of his villany. Contrast with Redemption Equals Death, where the villain was no longer a villain when he died. If the villain is still alive but his superiors have ordered him to go get killed, that's Uriah Gambit.

Comic Books

 * A really sad example in the DC Golden Age, later retitled Earth Two incarnation when Bruce Wayne gives Selina Kyle a lavish funeral. She died during a heist gone wrong, and he gives her a funeral worthy of a Wayne. Why? Because Selina was a Wayne by marriage; she pulled a Heel Face Turn after Faking Amnesia about her criminal background, and married Bruce, settling down to start a family with him. A former henchman named "Silky" Cernak framed Selina for murder long after she married Bruce, blackmailing her to do a heist as Catwoman using a doctored photo. Batman and Commissioner Gordon tried to stop the heist, only for Batman to kick a gun from a Mook's hand and cause it to misfire, hitting Selina and knocking her off a mezzanine, fatally injuring her. Accidentally killing his wife caused Bruce to retire as Batman, while motivating their daughter Helena Wayne to become the superhero Huntress to avenge her mother. She and Bruce track down "Silky" Cernak, and obtain the proof that Selina was never a killer during her criminal life, giving Bruce closure shortly before he dies a year later.
 * Happens in Teen Titans during The Judas Contract arc. After Terra dies attempting to bury the Titans in rubble and they deliver her employer-lover Slade Wilson to the cops, they all agree that it's in their best interest that no one knows Terra joined the team specifically to betray them to H.I.V.E. and was pure evil. They give her a Titans funeral with honors. While Raven and Robin conclude that Terra was evil from the start and remain solemn, Beast Boy is in denial, and spends the funeral sobbing over the girl he loved. This has repercussions in a later arc where a villain in the future tries to replicate the exact same plot.

Film

 * A variant occurs in Batman: Under the Red Hood. Batman has a memorial for Jason Todd in the Batcave, to remind himself of the son he lost. After learning that the Red Hood is a resurrected Jason, who tries to get Bruce to break his code by killing the Joker, Alfred asks with sympathy and calm if they should dismantle the case. Bruce says no; despite what happened and what Jason is doing now, he was still a child when he died, and a hero.
 * The Dark Knight ends with this: after Joker corrupts Harvey Dent into killing five people and nearly murders Gordon's young child, Batman and Commissioner Gordon discuss that if word gets out about the truth, all the work that Harvey did will be for nothing because the criminals in jail will get released on mistrial. Batman looks at Dent's body, and turns it over to hide the Two-Face. He convinces Gordon to frame Batman for the murders instead. The movie ends with Harvey receiving a full civil servant funeral.
 * In Sam Rami's Spider-Man Peter covers up the nature of Norman Osborn's death, and his identity as the Green Goblin, as not to upset his friend Harry. In the next scene, Norman is seen being buried, with the public none-the-wiser.

Literature

 * The Apollo Murders: It wasn't until the book's villain was told to make sure his story was straight before his trial that he realizes he was not only acting against NASA's interests but was also guilty of murder and treason. He drowns himself, but because of his high-visibility position in a program faced with massive budget cuts, NASA gives him a headstone at Arlington.

Live-Action TV

 * NCIS decided to do this with The Mole Agent Michelle Lee, after learning that she was blackmailed into her role. When her handler uses her as a Human Shield against Gibbs, she signals for Gibbs to shoot her, sacrificing her life in the process. Despite knowing how much information she compromised, NCIS covers up the treason and gives her a funeral with full honors.

Newspaper Comics

 * Villainous inversion during Flash Gordon. One arc featured Emperor Ming capturing Flash Gordon, having doctors treat him, and then doing a public execution. Afterward, he erects a large ostentatious tomb where Flash's body will rest for eternity, to break the rebellion's spirit. Fortunately, a doctor helped Flash fake his death in thanks for a life debt, and he graffitied: "MING LIES; FLASH GORDON LIVES" on the tomb before making his getaway.

Oral Tradition, Folklore, Myths and Legends

 * It's a staple of Hindu Mythology. You can have evil people, demons, and deities, but if they stuck to their dharma and honor, they can receive a funeral that purifies them of their sins and ascend to heaven.
 * After Vishnu as his Narasimha avatar kills Prahlad's father for attempting to kill his son, Narasimha says Prahlad must have a boon for his worship. Prahlad requests his father is purified for his sins in death. Narasimha says if Prahlad takes the throne and rules wisely, that will be done. He gives his father a kingly funeral.
 * When Karna dies in The Mahabharata, the Pandavas just remember him as the charioteer boy that beat them in archery and the Number Two to the war's instigator, Duryodhana. It's only after the war that their mother Kunti begs them to give him a proper funeral, because he's their older brother. She had him out of wedlock and sent him out on the river, where charioteers found him. They don't take it well, especially Jerkass Arjuna, but give him a funeral.

Video Games

 * In Valkyria Chronicles III, The Nameless (the story's protagonists) privately give traitor Gusurg a funeral after they kill him because its members understand (though not necessarily agree with) with his reasons for betraying Gallia, and still genuinely respect his mentorship/leadership and the friendships they had before his betrayal.

Western Animation

 * In the Teen Titans adaptation of the Judas Contract arc, a variant is added. Unlike in the comic where the Titans were able to cover up Terra's treachery, they don't have that option when she leads armies of Sladebots into Jump City to forcibly take over and "evacuate" the civilians. When the dust is settled, literally, Terra is turned into a statue due to pulling a Heroic Sacrifice to stop a volcano she accidentally activated when fighting Slade. The civilians return, bewildered as they try to adjust to a normal life, while underground, the Titans place a memorial plaque by Terra's statue declaring her a Titan despite her betrayal, and flowers courtesy of Starfire. Raven, Robin and Cyborg say that she'll try to reverse the effects to bring Terra back, but Starfire and Beast Boy truly believe she's gone forever. The season five finale confirms Beast Boy visits her statue regularly enough to talk to her, and is shocked when it goes missing.