All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Moreover, Ibn ‘Abbaas narrated that the Prophet said: “If people were to be given according to their claims, then some men would claim the blood and property of others, but the burden of the proof is upon the claimant and the taking of an oath is upon the one who denies (the allegation).” [Al-Bukhari and Muslim]
However, people are not all the same. Some are righteous while others are not. The rulings differ depending on the difference of states. Shaykhul Islam Ibn Taymiyyah spoke about the categories of people who are accused as he said: “...The Third Category: that the accused is known for his dissoluteness, like a person who is accused of theft if he was known before that to be a thief, and someone accused of highway robbery if he was known to rob people on the roads, and someone accused of murder or if anyone is known to do that..." until he said: "It is permissible to beat that kind of accused people in the same manner that the Prophet, sallallaahu ‘alayhi wa sallam, ordered Az-Zubayr to punish a man who had hidden his money until he confessed that he had hidden it, as related in the story of Ibn Abul-Huqayq.” [End of quote]
Hence, the matter of beating is related to this category of people and not to every accused person.
Finally, since this issue is a door to whims and taking revenge, some scholars are stringent in this matter and say that it is in the hands of the ruler and not the judge, and some of them say that the matter is in the hands of both the ruler and the judge, and some of them say that such a person should be imprisoned and not beaten. Ibn Taymiyyah, may Allaah have mercy upon, mentioned these opinions in the same context.
Allaah Knows best.