This is a utilitarian dilemma. A broader, consequentialist dilemma could ask whether having an absolutist stance toward certain rules or rights, like the right to a due process of law, is more useful than saving a person or small group.
Put another way, thinking past the dilemma in this situation, it could be said that the practical consequences of a judge violating that stance towards rights, and by extension the reliability of law, might or might not outweigh the potential benefits of trying to preserve life and property.
It might depend on the moral ethics of whatever field the agent finds themself in.
For example, at about 18:20 of this podcast discussing the impact of continuing education about the Holocaust on medical ethics, one medical student discusses the Nuremberg trial of Nazi physician Gerbhardt. The student paraphrased his arguing, “You cannot prosecute me on the basics of ethics, only the law,” and he adds, “because at that time there was no ethics, which he was right to point out.” I haven’t checked what laws he was specifically charged with breaking and whether they were state or international, but he was executed all the same.
There seems to me a need to balance the obligation toward the state and the individual. Going wholly to the individual could undermine the establishment’s effectiveness, but going wholly to the state, as the podcast discusses, would justify physician participation in Nazi Germany’s eugenics program. More than 50% of physicians joined the Nazi party, and they killed 300,000 people in hospitals, not camps. While there are examples of physicians who hid and protected Jews and other targeted groups, I can’t tell at the moment whether that was the norm.