They will sometimes not even be aware of it what the law and formal guidance say.
That is exactly when one hopes:
kindness, humanity, common sense, practicality, decency
would be in effect, the law wouldn't be so necessary then. It seems very much in short supply.
It seems the current system's aim is to corall the demented, keep them quiet and stop them causing trouble until they die.
My experience totally, its not the demented causing the trouble though.