If you have Spectrum Cable, you can watch On Demand an episode of the TV show, Bull, on CBS. It's Season 3, Episode 10, titled, "A Higher Law." It's where someone accidentally runs over a woman & kills her. The driver confessed to a Catholic priest right afterward. The priest drove the van back, alone, to look for the woman, in case she was still alive. He got there just before the police got there and they saw him over the body. They arrested him.
At the trial, he kept saying someone else did it. But, as the driver confessed to him, he cannot break the seal of confession to say who that person is. But, it turns out, there was some loophole about how the confession happened. When the driver had shown up in his parking lot, distraught and a big dent in the van, the priest asked the driver what happened. That was when the driver confessed.
Unfortunately, in court, since the priest asked what happened, instead of the driver voluntarily coming to him to tell him, they said the "confession" doesn't count in a court of law.
The judge told the priest that by law, he was obligated to tell the court what happened. If he doesn't he will find the priest in contempt and lock him back up. (He was out on bail.)
The priest said he answers to a higher authority and won't say. The judge held him in contempt and sent him back to prison. The priest was willing to be sentenced to prison for 25 yrs to life for a crime he didn't commit, instead of breaking the seal of confession.
Of course, it's up to Bull to figure out how to get the priest declared innocent. . .
I think Law & Order had a similar type episode. Doesn't matter what the law is or what the courts demand. The Catholic Church has it's own rules about the seal of confession which priests must follow.