I'm sure that the rules are different for important people. But in general, no armed foreign boat is allowed in any port in the world unless it is a military vessel with an agreement already in place.
It's completely legal to summarily execute pirates in most of the world.