“ The Two Popes ” is really three movies: a behind-the-scenes tale of Vatican politics, a mini-biopic about the current pontiff, and a two-man study of friendship, rivalry and major British acting. The first, though intriguing, is more puzzling than illuminating. The second feels a bit like a Wikipedia page, albeit one with first-rate cinematography. The third is absolutely riveting, a subtle and engaging double portrait that touches on complicated matters of faith, ambition and moral responsibility.

Directed by Fernando Meirelles (“City of God,” “The Constant Gardener”) from a screenplay by Anthony McCarten (“Darkest Hour,” “Bohemian Rhapsody”), the film begins in 2005, after the death of Pope John Paul II. The cardinals of the Roman Catholic Church gather at St. Peter’s to elect a successor, settling on Joseph Ratzinger (Anthony Hopkins), who becomes Pope Benedict XVI. The runner-up is Jorge Bergoglio (Jonathan Pryce), an Argentine priest who will replace Benedict eight years later, becoming Pope Francis in a highly unusual transfer of ecclesiastical authority.

That’s hardly a spoiler, but “The Two Popes” observes the transition with an attention to detail that produces a surprising degree of suspense. In 2013, Bergoglio, who seems more at home on the motley streets of Buenos Aires than in the hushed baroque chambers of the Vatican, travels to Rome to ask the pope’s permission to retire. Benedict, receiving his visitor at the papal summer residence in Castel Gandolfo, has other plans, though they aren’t clear at first.

What is clear is that the two men, who may be brothers in Christ, are not friends. “I disagree with everything you say,” Benedict snaps at one point, and while their conversation is marked by deference and decorum, the temperamental and ideological gulf between them seems unbridgeable.