https://plato.stanford.edu/entries/torture/
The Stanford Encyclopedia of Philosophy lists a real life example along the lines of my hypothetical one. In this example, a child is stuck in a hot car that is parked in a spot known only to the in custody car thief who is refusing to talk. The police proceed to beat the thief until he talks and save the child's life. This is straightforward example of when pragmatism must overrule idealism.
The purpose of my example was to create a situation where it should be obvious the right move is to go against idealism. The reason is, if your starting point is something like "We must never deny people their rights" I'd like to show you an extreme example where, actually, we must. If you can agree on the extreme example, then the discussion becomes a matter of degree - i.e. when is it okay to deny people their rights versus when it is not. This is actually the more nuanced and realistic discussion that has applicability to the real world.
(edit: now I notice it was written by an Australian)