Settlers of Catan Cities and knights - Knights VS Barbarians
First, you check if Catan wins or not by comparing the strength of the barbarians (the number of cities) against strength of the knights (the sum of the value of active knights). In the event of a tie in the strengths, Catan wins.

If the barbarians win, the player who contributed the least has one of their cities pillaged. In the event of a tie for the lowest contribution, all players who contributed the least have one of their cities pillaged.

If Catan wins, the player who contributed the most gets a Defender of Catan card worth 1 VP. In the even of a tie for the highest contribution, all players who contributed the most get a progress card of their choice instead.