According to kant, the moral value of an action depends upon how closely it aligns with: the underlying moral rule.
For example, punching other people is generally considered as bad. But if we punch someone who tried to do harmful things to our children, the actions can be justifiable because of the moral value.