There have been rumours of powerful lobbying behind the scenes to sway the court's decision.
The fact that the Constitutional Court suspended Gen Prayuth from his job while they reached their decision - widely seen here as a humiliation - and that he did not get his preferred outcome, suggests there are splits in the broad conservative coalition which chose him as leader in 2019. เรตมวยวันนี้
He is much less popular now, after eight years in which the Thai economy has not performed well, although there is no obvious rival as the figurehead for conservative, royalist values.
What all this manoeuvring underlines is how fluid and unsettled Thai politics still is, more than eight years after a coup whose leaders said they were going to sort out the country's political arrangements once and for all.