If god is all-powerful and Jesus could perform miracles, why didn't either of them do anything to stop him from being nailed to a cross?

If god is all-powerful and Jesus could perform miracles, why didn't either of them do anything to stop him from being nailed to a cross?
Post Opinion