C bosses were initially concerned about incorporating The Pope in "Doctor Who".
Show runner Steven Moffat came up with the idea of featuring the Pontiff in an episode called "Extremis" but executive producer Brian Minchin was so worried about potential backlash from viewers that he asked the BBC for advice beforehand.
Speaking to Daily Star newspaper, Steven said: "I did wonder if I'm allowed to do it.
"And the moment Brian Minchin read the script he had to go to the BBC and say "look Steven is doing this. What do we think?" You have to keep in mind that Catholics with great regard for the Pope will watch this and they will expect not to be sneered at.
"You're entitled to watch a TV show and not be sneered at if you're a perfectly kind law-abiding citizen. We can't just go around saying "The Pope is corrupt and God's just a made up person". We've brought in the Prime Minister and the American President so why shouldn't the Pope turn up?"
In the episode, which will be aired on BBC One this Saturday (20.05.17), features Joseph Long as His Holiness and he asks the Time Lord (Peter Calpaldi) to solve a mystery about an ancient text called Veritas buried in the Vatican.
The Pope is also reported to take a ride in the TARDIS.
Calpaldi, 58, has portrayed the Time Lord in the BBC sci-fi drama for almost four years but will exit the TARDIS for the last time in the 2017 Christmas Special along with Moffat who will no longer be the showrunner of the successful show.
A number of replacements have been rumoured including hints at a potential woman replacing the Time Lord - which will mark the first time in "Doctor Who" history.