In 2 Maccabees 12:39-461
After a bloody battle was won over enemies from Cypress and Joppa, Judah Maccabee, in recovering his dead soldiers' bodies for burial, discovered that many had worn under their garments some images of pagan idols for protection in battle -- which was prohibited by the Hebrew faith. Judah considered the bravery and the sacrifice the men had made for their people. He then sent 12,000 silver drachmas to Jerusalem for the priests to offer sacrifice for the heroes of the war. It would be senseless to do this had he not believed that there was some possibility to expiate their sins and gain mercy and forgiveness.
Text note from the Douay Rheims Bible follows.
NOTE: "With godliness: Judas hoped that these men who died fighting
for the cause of God and religion, might find mercy: either because
they might be excused from mortal sin by ignorance; or might have
repented of their sin, at least at their death."
Vere 46
It is therefore a holy and wholesome thought to pray for the dead,
that they may be loosed from sins.
It follows to ask where were these souls so that they may receive mercy? Judah Maccabee asked himself a logical question about God's justice, interceded for his men with hope, and trusted in God to judge his dead heroes.
1 39 And the day following Judas cam with his company, to take away the bodies of them that were slain, and to bury them with their kinsmen, in the sepulchres of their fathers.
40 And they found under the coats o the slain some of the donaries of the idols of Jamnia, which the law forbiddeth the Jews:
41 Then they all blessed the just judgment of the Lord, who had discovered the things that were hidden.
42 And so betaking themselves to prayers, they besought him, that the sin which had been committed might be forgotten. But the most valiant Judas exhorted the people to keep themselves from sin, forasmuch as they saw before their eyes what had happened, because of the sins of those that were slain.
43 And making a gathering, he twelve thousand drachms of silver to Jerusalem for sacrifice to be offered for the sins of the dead, thinking well and religiously concerning the resurrection,
44 (For if he had not hoped that the that were slain should rise again, it would have seemed superfluous and vain to pray for the dead,)
45 And because he considered that the who had fallen asleep with godliness, had great grace laid up for them.
46 It is therefore a holy and wholesome thought to pray for the dead, that
they may be loosed from sins. that all plainly saw, for this cause they were slain.