Rambam in the laws of kings 3:10 states
כל ההורג נפשות שלא בראיה ברורה. או בלא התראה. אפלו בעד אחד. או שונא שהרג בשגגה. יש למלך רשות להרגו ולתקן העולם כפי מה שהשעה צריכה. והורג רבים ביום אחד ותולה ומניחן תלויים ימים רבים להטיל אימה ולשבר יד רשעי העולם:
The king has the right to execute a killer, even when there is no clear proof (against him) or no warning was given him or even if there was only one witness. He may execute someone who killed accidentally out of hatred. He may do so for purposes of establishing Public Order, as is necessary depending on the prevailing circumstances. He may even execute many people on one day and hang them and leave them hanging for many days in order to instill fear and crush the hands of the wicked of the world.
I would like to know the source in the Torah, ie 5 Books of Moshe, which provides the king power to execute someone or many people without due legal process and when the person in question has not committed an act of rebellion against the king (mored b'malchut).