Mechanism for spiral wave breakup in excitable and oscillatory media.