It gets much worse than that in specific sections of law. It is very common, for example that for minors and mental health patients decisions work (trying to translate a french term) "without presupposition".

(this is about Belgium)

This means 2 things:

1) decisions taken by the executive power are not influenced by the court decision (famously one to keep a minor in solitary confinement for ~2 months and at one point forgetting to feed him for nearly 2 weeks, he had to drink from the toilet). The state got convicted ... and he got sent back to the same institution, never to be heard from again ("that would violate his privacy", sadly not joking). Legally, they could have prevented him from attending the trial in the first place. For "some reason" he never filed the open-and-shut case for monetary compensation that he was sure to win ... Never heard from again.

But don't worry, that decision was made "in the interest of the child" (says the organization that kept him in isolation for 2 months and didn't feed him for 2 weeks. Needless to say, the actual spokesperson at this point asked his name be kept out of the paper for that statement. The paper obliged)

2) if a defendant goes to a higher court, this does not halt execution of the decision. For example, a child services employee* takes the decision to take kids away from their environment and "place" them in an institution (meaning a child prison, but don't call it that) (note: this is mostly done WITHOUT those children having committed a crime, 75% of decisions are made because a state official has decided the parents aren't fit to be parents, though it's true that it's also done when they do)

* I wish I could say they used psychologists to make these decisions. That WAS true, not anymore. It is not anymore. At this point it's partly high schoolers (high school in Belgium has a social sciences/psychology year, an education with an incredibly bad reputation), and you're lucky to find one psychologist in the entire organization (technically there's 1 per province, but they "never look at individual cases").

Now at this point the parents aren't informed, nor is the child. Then the police turns up and takes the kid away, often in violent encounters. At some point this comes to a real judge, and let's say the youth judge decides the government was wrong to do this. What happens now ?

Nothing. The child is not returned. The current in-progress process is executed (and if that process is placement in foster care, that means the child is never returned, or at least not before adulthood). It is a crime to attempt to make that happen anyway.

3) Let's say child was not taken in the first place, but the youth judge decides to place the child. The parents or the child decide to appeal the decision.

What happens next ? The child is taken away by the police and placed. It is a crime to attempt to stop this.

Similar things can happen to mental patients, even if the court decides they were wrongfully diagnosed as mental patients in the first place.

And of course, yes, politicians have been convicted of using this to imprison political opponents.

Judging by the wikipedia page, this is in fact pretty common across the world:

https://en.wikipedia.org/wiki/Political_abuse_of_psychiatry

And then I'm not even mentioning the real scandals. For example, youth services couldn't "place" some children. They weren't with their parents. After a while they find them: the parents had sent them, with the grandparents, to Croatia.

Youth services runs into action. Kidnapping (not really, of course) ! They send agents there, and arrest the grandparents.

It took 2 weeks before someone asked "and the children ?". Well, they left the children behind in Croatia, and they are still in a mental institution there, in Zagreb ... 2 years old and 7 years old.

Needless to say, the person to ask this question was the mother of the children, who had to do this from behind bars (despite that she would not be convicted). It only worked because her lawyer went to the papers.

The grandparents were convicted of kidnapping. The parents were not convicted before a court for any wrongdoing (how disgusting is it that they even tried to convict them after doing that to their children ?). The state, needless to say, objected to the decision to not convict the parents, and appealed the decision, without getting a conviction, but they did imprison the parents for that period. Over 2 years behind bars for those parents, without conviction, with their children in a mental institution in Zagreb.

Needless to say, nobody in the police or youth services was even internally disciplined.

Equally needless to say, the power of these services has since been expanded and oversight reduced, as well as their budgets to hire capable people.

Incredibly offensive fact: due to the fact that youth services take so many children away from their parents, but don't actually have places to put them, they've started putting them in boarding schools. There's a tiny problem with that: those close in the weekends and during school holidays, and mostly demand those children leave. No alternatives are given to those children, so they're homeless at that point, have to sleep in the street. This has grown to be the number one complaint from these children.

If they get help at their parents or family they are punished by youth services ...