The word you're looking for is "justifiable" or "morally justified." It describes a situation where someone does something bad or morally questionable, but there is a valid reason or justification for their actions.