They will try to attack the ship with the highest level :) If they are friendly, they will escort them around instead.
They shouldn't chase those who've left the galaxy though, I just fixed that, will be in the next version.