A moral victory occurs when a person, team, army or other group loses a confrontation, and yet achieves some other moral gain.
For example, a sports team that is a heavy underdog and loses narrowly to a superior opponent might claim a moral victory, acquitting themselves well even in defeat.
[1] A team that plays fairly and loses to a cheating team might also claim a moral victory in spite of the loss.
Another moral victory can be seen in Arthur Miller's play The Crucible, where the character Giles Corey was pressed to death by large stones because he remained silent, neither denying nor confirming the accusations of witchcraft.
Others may include scenarios in which a force loses a struggle, but inflicts great losses upon their opponents (the opposite of a Pyrrhic victory.