The key part of that, that makes it obviously morally correct is:
> if it's necessary to do so
There is no road in the context. It's either sacrifice the small group, or save the whole - that's the entire proposition. If you remove the necessity part, that changes the equation entirely.
To paraphrase: "The ends justify the means".
I disagree. That road leads to all kinds of evil.