Who elects the Pope: the cardinals or the Holy Spirit?

It has been held throughout history that the election of the pope is inspired by the Holy Spirit, that is, by God himself, since, according to Catholic theology, God exists in three persons: the Father, the Son (Jesus Christ), and the Holy Spirit, what they call the "Holy Trinity": a single divinity manifested in three persons; not three gods, but one true God.
And this is where one wonders: if the Holy Spirit, that is, the one true God, supposedly "inspires" the cardinals in the election of the pope, why have there been such corrupt and harmful popes? There have been, and in generous numbers, as Benedict XVI himself acknowledged, as I will point out below. But let's not just talk about corrupt popes. John Paul I, for example, was not corrupt, but a very good man. Why did the Holy Spirit inspire the cardinals to elect a pope who would last only 33 days in office? I'll return to John Paul I, because his election raises a problem that, at least for me, is fascinating.
During Holy Week, I published an article on the Apocatastasis, or Final Restoration. Without going into details, Church intellectuals have always tried to explain evil, and the conclusion has been that God is not the cause of evil. If God is the beginning and end (the alpha and omega), how can we explain evil? And this is where free will comes in: God, in his infinite goodness, created spiritual beings in his image and likeness, endowed with freedom. And under that freedom, these beings can say "no" to God, distance themselves from him, oppose his plans, and become enemies. In a similar way—analogously similar, and this is not a pleonasm—the Holy Spirit does not directly elect the current pope; otherwise, the conclave would be a farce. We could not say that God has directly chosen evil and corrupt popes, because that would be directly attributing to God that he has wanted an evil, deceitful, murderous, and traitorous person at the head of his church, because that is how there have been popes: evil, deceitful, murderous, and traitorous.
According to Catholic theology, God, through the Holy Spirit, “inspires” the cardinals in the conclave to elect the pope, but does not force them. Here again, free will. If an evil and diabolical pope is elected, it could not have been God who desired and ordained it; but He did allow it because He unrestrictedly respects human freedom. The blame for such an election lies with the cardinals, not with God. Instead of being inspired by divinity, since cardinals have free will, they can say “no” to God and vote for worldly and selfish reasons, as has happened countless times throughout twenty centuries of the Church.
Who elects the pope? The answer is: the cardinals, in the sense that God does not restrict them or suppress their freedom, even though God has, let's say, "His candidate"; which in some way He does, otherwise the "inspiration" of the Holy Spirit would be meaningless. From a theological point of view, when the cardinals are in conclave to elect a pope, they are under a "special grace of state" that the Holy Spirit has granted them so that they can fulfill in the best possible way the enormous responsibility of electing the Vicar of Christ, the shepherd who will lead the flock. But no matter how much grace God grants, it does not suppress freedom, so that a given cardinal, or several, can reject, resist, or abhor divine grace and elect a crook or an unworthy person, as has often happened. Consider the Borgia popes, who practiced corruption and nepotism to scandalous levels; Or Stephen IV, who exhumed his predecessor to judge him and throw him into the Tiber; or Boniface VIII, whom Dante places in the hell of the Divine Comedy; or Urban VI, who provoked the Western Schism and didn't hesitate to murder his enemies; what can we say about the up to three popes who coexisted at a given time, each claiming to be the legitimate, only, and true pope; or Leo X, who began selling indulgences and practicing simony, which was one of the causes of the Lutheran Reformation; or John XII, who behaved like a degenerate Roman emperor and turned the Holy See into a brothel; or Benedict IX, who put the papacy up for sale. And I'll stop telling you more, so as not to anger those who believe that all popes are "Holy Fathers."
But we must also be fair and point out that there have been good people among the popes. Yes, we must point out the bad, but also the good. Of the 266 popes up to Francis, 83 have been canonized and 9 have been blessed. These are good numbers, even assuming it's a recognition they give each other. We're talking about a third of all popes, which shows that perhaps there has been more good than bad.
But let's return to our topic. Can we say, in any sense, that God elects the pope? The Ordo Rituum Conclavis points this out. Yes, in the sense that it is God who confers upon the pope the mission of leading the Church. According to Catholic theology, a validly elected pope receives his authority from God, not from the cardinals. The pope, therefore, is God's representative on earth—not of the cardinals, not of the clergy, not of the faithful, but of God himself, because God has so willed it.
When Francis was elected, this proclamation was made:
«O God, Shepherd and Rector of all the faithful, look favorably upon your servant Francis, 'whom you have chosen as the shepherd of your Church': grant, we beseech you, that he may benefit, by word and example, those over whom he presides, so that, together with the flock entrusted to him, he may attain to everlasting life. Through Jesus Christ, Our Lord. Amen.»
It says that God (yes, God) wanted to elect his servant Francis (Jorge Mario Bergoglio) as pope. So it seems so: God plays a fundamental role in the election of the pope, inspiring, through the Holy Spirit, the cardinals in the conclave, and directly conferring authority on the pontiff. If a scoundrel is elected, it wasn't God, but the cardinals who rejected divine grace. God doesn't make mistakes.
Interviewed by Bavarian television in 1997, the then Cardinal Ratzinger answered, in response to the express question of whether the Holy Spirit chose the pope:
«I wouldn't say that in the sense that the Holy Spirit chooses the Pope. I would say that the Spirit doesn't exactly take control of the matter, but rather, like a good educator, so to speak, leaves us a lot of space, a lot of freedom, without completely abandoning us. Therefore, the role of the Holy Spirit should be understood in a much more flexible sense: it's not that he dictates which candidate to vote for. Probably the only guarantee he offers is that we don't totally screw things up. There are too many contrary examples of popes that the Holy Spirit obviously wouldn't have chosen!»
All of the above applies if you are a believer. In matters of religion, I confess with some sadness that I am like a stone that believes in nothing. My situation is worthy of pity, and for believers, I am a sinner who will burn in hell. I think the Vatican is just another state, an elective monarchy with its own rules, procedures, and rites. I see nothing supernatural in it. As men, the pope and the cardinals are subject to passions, emotions, and the things of the world. They are not perfect or immaculate, although I do not doubt that there are some, perhaps many, who are very good, just, and kind. I know that among men in cassocks, envy, selfishness, betrayal, blasphemy, and evil can prevail. What's more, many of them don't even truly believe the word of the Lord. I do not idealize them, and believers would be very wrong to idealize them. In recent decades, only the last two popes have had the courage to denounce and punish the pedophilia of many priests. If I start listing the anomalies, scandals, and bad examples of priests at all levels, I'll never finish. That's why I don't believe the story that priests are holy men. They're not holy, and sometimes not even that holy. I do recognize that within the Church there are good people and bad people, as in any other organization. I frankly doubt that the Holy Spirit, if he exists, has much to do with Vatican affairs.
Finally, the election of John Paul I, who has been declared a Servant of God, the first step toward achieving sainthood. I said I would return to it, and here I am. There is no doubt, at least for me, that he was a very good, kind, and just man. If I believed in the inspiration of the Holy Spirit, I would have no doubt that Albino Luciani was God's candidate after the death of Paul VI. What I don't quite understand is how God would have wanted a person who would die thirty-three days later. Well, Luciani didn't even have time to say "pious." Wouldn't it have been easier to elect Karol Wojtyla immediately—in fact, he received some votes—if he would anyway be God's candidate in the next conclave that would take place a few weeks later? Well, between the election of John Paul I and John Paul II there are barely seven weeks and two days. Catholics will tell me that God works in mysterious ways that I can't understand. Exactly. I can't understand it. I believe the Holy Spirit is "the invisible friend." But I'm just a mere mortal without faith, so don't pay attention to my nonsense.
Eleconomista