Why was excommunication important during the Middle Ages?

Excommunication removed church leaders from power.

Excommunication was one way popes held power over Medieval kings.

Excommunication gave kings more rights than religious leaders.

Excommunication gave the pope the right to appoint kings.