The Stanford Encyclopedia of Philosophy has a real-world case that took place in Australia around 30 years ago.[1] Apologies for the length. It's not easy to accurately summarize:
> Height of the antipodean summer, Mercury at the century-mark; the noonday sun softened the bitumen beneath the tyres of her little Hyundai sedan to the consistency of putty. Her three year old son, quiet at last, snuffled in his sleep on the back seat. He had a summer cold and wailed like a banshee in the supermarket, forcing her to cut short her shopping. Her car needed petrol. Her tot was asleep on the back seat. She poured twenty litres into the tank; thumbing notes from her purse, harried and distracted, her keys dangled from the ignition.
> Whilst she was in the service station a man drove off in her car. Police wound back the service station’s closed-circuit TV camera, saw what appeared to be a heavy set Pacific Islander with a blonde-streaked Afro entering her car. “Don’t panic”, a police constable advised the mother, “as soon as he sees your little boy in the back he will abandon the car.” He did; police arrived at the railway station before the car thief did and arrested him after a struggle when he vaulted over the station barrier.
> In the police truck on the way to the police station: “Where did you leave the Hyundai?” Denial instead of dissimulation: “It wasn’t me.” It was – property stolen from the car was found in his pockets. In the detectives’ office: “It’s been twenty minutes since you took the car – little tin box like that car – It will heat up like an oven under this sun. Another twenty minutes and the child’s dead or brain damaged. Where did you dump the car?” Again: “It wasn’t me.”
> Appeals to decency, to reason, to self-interest: “It’s not too late; tell us where you left the car and you will only be charged with Take-and-Use. That’s just a six month extension of your recognizance.” Threats: “If the child dies I will charge you with Manslaughter!” Sneering, defiant and belligerent; he made no secret of his contempt for the police. Part-way through his umpteenth, “It wasn’t me”, a questioner clipped him across the ear as if he were a child, an insult calculated to bring the Islander to his feet to fight, there a body-punch elicited a roar of pain, but he fought back until he lapsed into semi-consciousness under a rain of blows. He quite enjoyed handing out a bit of biffo, but now, kneeling on hands and knees in his own urine, in pain he had never known, he finally realised the beating would go on until he told the police where he had abandoned the child and the car.
> The police officers’ statements in the prosecution brief made no mention of the beating; the location of the stolen vehicle and the infant inside it was portrayed as having been volunteered by the defendant. The defendant’s counsel availed himself of this falsehood in his plea in mitigation. When found, the stolen child was dehydrated, too weak to cry; there were ice packs and dehydration in the casualty ward but no long-time prognosis on brain damage.
I cannot fault the actions of those police. What they did was blatantly illegal, but it was also clearly moral. That crucial distinction is too-often glossed over in these discussions. Torture should be illegal, but there are a few extreme circumstances in which it's moral.
This is similar to other crimes: obviously we want to criminalize actions such as theft and trespassing, but we recognize that it is sometimes moral to break those laws in pursuit of a higher good. (Say... you are bitten by a snake while hiking and trespass to get to help faster.) We recognize that no sane prosecutor would ever charge someone in those circumstances, and no sane jury would convict.
1. https://plato.stanford.edu/entries/torture/#CaseStudBeat