I was reading about the Papal States and it seems to me that the majority of the wars they fought in were against other Catholic nations, even against such monarchs as Philip II of Spain, the "defender of the Catholic faith". Did these rulers see the papacy as a chiefly temporal office, or did they have reservations about going to war with a man recognized as the Vicar of Christ?
The answer will, of course, vary, but people are generally pretty good at coming up with some reason to justify themselves. Examples include, but are not limited to: the pope is illegitimate (reasons of election, consecration, etc.); he does not have temporal rights to [specific area]; he is being corrupted by perfidious advisers.
The negotiation that goes on between religious belief and Realpolitik in relation to the Catholic Church is always an interesting one to study. Part of it has to do with the fact that the modern idea of "religion" does not really apply to the pre-modern period. The Latin religio means something closer to "ritual practice" or "supernatural obligation," rather than a concrete noun. And when you find it in the medieval context, it is almost always being used to mean "a person in a monastic vocation" (as opposed to the secular---non-monastic---clergy). The evolution of the modern meaning of "religion" (i.e. as one of many orthodoxies, rather than a singular orthopraxy) is the product of post-Reformations religious pluralism and the creation of a European global awareness. Gil Anidjar put it best: "Secularism is the name Christianity gave itself when it invented religion, when it named its other or others as religions." (1)
All this is to say that "religion" in the modern sense was something that was taken for granted in the pre-modern period in a way that it is not any longer. Many things that appear to us as ironies can be explained by this disconnect.
(1) Gil Anidjar, "Secularism," in Critical Inquiry 33 (2006), 62.