The first. Resolve the treachery then discard it.
From the rulebook:
An encounter card attached to a guarded objective is dealt with in the following method, depending on its card type:
Enemy: The enemy leaves play, either by being defeated or as the result of a card effect.
Location: The location leaves play, either by being fully explored or as the result of a card effect.
Treachery: The treachery’s effects resolve, or are canceled. (Treachery cards are immediately triggered when they are revealed.)