St. John Eudes says good Priests are a priceless grace, and a sign of God's Mercy. We all should pray for our Priests to be such, and for God to send us such good Shepherds or Pastors for His flock. Similarly, bad Priests are a terrible chastisement coming from His Justice,
“The most evident mark of God’s anger and the most terrible castigation He can inflict upon the world are manifested when He permits His people to fall into the hands of clerics who are priests more in name than in deed, priests who practice the cruelty of ravening wolves rather than the charity and affection of devoted shepherds. Instead of nourishing those committed to their care, they rend and devour them brutally. Instead of leading their people to God, they drag Christian souls into hell in their train. Instead of being the salt of the earth and the light of the world, they are its innocuous poison and its murky darkness. …
When God permits such things, it is a very positive proof that He is thoroughly angry with His people, and is visiting His most dreadful anger upon them. That is why He cries unceasingly to Christians, ‘Return, O ye revolting children…And I will give you pastors according to My own Heart’ (Jer. 3:14-15). Thus, irregularities in the lives of priests [and surely popes, as well] constitute a scourge visited upon the people in consequence of sin.” (Chapter 11 – Qualities of a Holy Priest)
“On the other hand, the greatest effect of God’s mercy, the most precious grace He bestows upon mankind, is to send worthy priests, men after His own Heart, seeking only His glory and the salvation of souls. The greatest blessing that God bestows upon a church, the most signal manifestation of divine grace, is to have a saintly shepherd, be he bishop or priest. This is indeed the grace of graces and the most priceless of all gifts for it includes within itself every other blessing and grace. What is a priest after God’s Heart? He is an inestimable treasure containing an immensity of good things.” (Ibid)
From:
https://catholicfamilynews.com/blog/2019/03/14/six-long-years-of-francis-outlasting-the-long-winter-of-this-pontificate/St. Alphonsus says similar things in "Duties and Dignity of a Priest". A Priest's main responsibility is to save the souls entrusted to him.