In medieval Europe, the Roman Catholic Pope seemed to hold more power than the European kings. This is strange because monarchs can raise armies. Pope and their bishops are not exactly military men. How did the Catholic Pope manage to become more powerful than Kings in medieval Europe without the support of guns and barrels?
This question needs a great deal more substantiation, but we can look to three fundamental factors that provided the base for the power of the Church and the Papacy in Medieval Western Europe:
Since during the period in question, religion in (Western) Europe was the virtual monopoly of the Catholic Church headed by the Pope, the sanction of the Pope was in many respects the source of any monarch's claim to the throne, and the power of any monarch was a function of that monarch's relationship with the Church.
Perhaps the most well known historical example of the intimate bond between Papal power and Monarchic Power is the English Henry VIII's formation of the Anglican Church in concert with Thomas Cromwell, the outcome of what came to be known as the King’s great matter
As long as Henry was beholden to the Pope in Rome, his situation as King was compromised. The only solution was to break ties with Rome and create a new church, which recognized Henry as King by Divine Right.
The situation in England typified what was common in Europe at large during the period in question:
Along these lines, with the founding of the Anglican Church Henry instituted the Dissolution of the Monasteries
Wealth and territory bequeath power; Kings need money.
Most nobles of the Middle Ages felt that they owed allegiance to TWO kings: 1) the king of their country, and 2) God, their heavenly king, for whom the Pope was the "viceroy" (vice-king) for Christians.
If anything, the Pope, as God's "representative" held greater sway over the nobles than the national king, because the Pope could quite literally tell the king (or the nobles themselves) to "go to Hell." And most Christian nobles believed that the Pope could send them there for all eternity, meaning that in a "forced choice," they would support the Pope over their king.
When the Holy Roman Emperor Henry IV got on the wrong side of the Pope in 1077 by trying to appoint bishops, the Pope excommunicated him. His "Electors" threatened to elect a new Emperor as a result. So Henry had to walk barefooted to the Pope's residence at Canossa and fast three days to get the Pope to remove the ex communication, so that he could maintain his political power.
In theory, the Pope only had authority over temporal matters, but in practice, there was a certain amount of overlap with secular matters. For instance, there were questions about whether the king or church could collect certain taxes, and how the money could be spent.
It was not until the time of Martin Luther, and the rise of Protestantism that people started to believe that the Pope did NOT have a monopoly on heavenly salvation, and therefore could be defied. But shortly afterward, during the time of Henry VIII, the Pope forebade his divorce from Catherine of Aragon on religious grounds, which had a bunch of political (secular) implications. Henry's response was to set up the Church of England and make himself a quasi Pope at the head of his own church.
It is unevident that he was. There were multiple instances when popes were desposed by various rulers.
For instance, Charles V took Rome and installed his own pope.
Since the position of a pope was electable, it was usually the most powerful state or alliance that influenced the decision on who shall be the pope.
The pope controlled the extensive church hierarchy and could excommunicate a king, but in return he could be desposed as well.
Another factor not mentioned in other answers seems to be something mentioned by Dan Carlin in a recent podcast: a trick played by Pope Leo III on Charlemagne, which had him place the crown on the kneeling king's head.
This basically confirmed that the Pope had the right to nominate/declare the king, and put the practical point on the "Catholic Justified Submission" theoretical argument discussed in an earlier answer.