Marx saw that history is subjected to determinism, that it is of the realm of matter. It is extraordinary therefore that in looking for justice, he ascribed to matter a capacity for producing justice. After all, why does history subjected to necessity automatically produce a happy Communist society? What god watches over it? We can understand that matter through evolution produced man. Why should it care that he be happy and live in a happy society? No one yet can understand why matter should have been “a machine for the manufacture of Good,” as Simone Weil says. This is the main contradiction at the base of today’s major philosophical controversy, and it cannot be bypassed.

Miłosz, Czesław. To Begin Where I Am. 2001. p. 215

Should a man suffer what he did, right justice would be done.
εἴ κε πάθοι τά τ᾽ ἔρεξε, δίκη κ᾽ ἰθεῖα γένοιτο.

Aristotle, Nicomachean Ethics 5.5.3, 1132b27