I note that you didn't answer the question, so I'll try another one.
Why didn't he just tell Pete to open the gate?
Why? Didn't I answer it? or should I put it another way you didn't like my answer? I'll expand to explain it so you can understand The Roman's believed he deserved it for undermining their rule and faith, Jesus asked of his followers not to fight for him because he must suffer for our sins to open the gates to heaven. Pete I believe got his job after the gate was made not before it was a border fence and he was just a border guard

. Now to directly answer your question did he deserve it? My answer would be depends which side of the movement you were on at the time. Even as a Christian the answer would be divided due to the outcome not the act, was it illegal? Nope it was the law of the land at the time and the rest is answered above