1. X is any way an agent (A) can be animated that is morally relevant.
2. A is morally accountable for X iff A is responsible for X.
3. A is responsible for X iff A is the ultimate cause of X.
4. From (3) and (4), A is morally accountable for X iff A is the ultimate cause of X.
5. A cannot be an ultimate cause of X unless A causes X.
6. From (4) and (5), if A does not cause X then A is not morally accountable for X.
7. If A causes X then A does so either necessarily or contingently.
8. Of metaphysical necessity, any contingent occurrence has itself got a causal explanation.
9. If an occurrence has itself got a causal explanation then that occurrence cannot be the first cause in a causal sequence.
10. If an occurrence is not the first cause in a causal sequence then it is not the ultimate cause of the causal sequence.
11. From (4), (8), (9) and (10), if A causes X contingently then A is not morally accountable for X.
12. From (6), (7) and (11), A can be morally accountable for X iff A causes X necessarily.
(Note: The language of being “animated” in “morally relevant” ways is used to refer to an agent’s action without using language that already presupposes that the agent is the responsible party. Look at the difference in language, say, between “an agent moving his hand” and “an agent’s hand moving”. The first implies that the agent is responsible, the latter leaves that open. In the same way being animated in morally relevant ways refers to an action that is morally significant (say murder, or rape), without suggesting an a priori commitment to the responsible party.)