Tactical retreat card

By Saifur, in Rex: Final Days of an Empire

If i use tactical retreat and the other player plays traitor card matching my leader , do i still lose all units and leader, or tactical retreat card is resolved before the other player resolves his traitor ? Since tha card says the battle is canceled , he shouldnt be able to use his traitor card ?