A method for ion based radiation therapy treatment planning for avoiding dose delivery to a distal risk organ, said risk organ being located after the target seen from a first beam angle, the method comprising defining an optimization function comprising at least one objective function related to at least one desired property of the treatment plan, wherein the objective function is related to limiting a parameter τ defining the fraction of the total number τOAR of ions that reach the risk organ relative to the total number τa of ions. In addition, one can assume a different density when calculating τ which will result in a plan that is more robust with respect to density perturbations.