The 10 steps followed on a Palo Alto Networks device to select the best path in BGP are:
If next-hop is reachable and it’s the only path, select this route.
Otherwise, select path with largest Weight.
If all weights are the same, select largest Local Preference.
If Local Preference is the same, select route that is originated by this router (0.0.0.0 in the next hop field), if any.
If no route originated on this router, select the shortest AS-Path.
If all paths the same, select path with lowest origin code (i [network statement] preferred over e [EGP] which is preferred over ? [redistributed from IGP]).
If origin codes the same, select path with lowest MED.
If equal MED, select external learned path over internal path.
If paths are internal, select path through closest IGP neighbor using the local routing protocol metric.