Church law does allow for a pope to resign - if he is of sound mind and not forced out by fear or fraud. Under canon law, if a pope chooses to resign, no one is allowed to tell him he can't.
According to the Vatican, John Paul II had secret letters, in 1989 and in 1994, offering to resign if he were too incapacitated to fulfill his ministry.
Pope Benedict said in Light of the World, a collection of interviews with a German journalist, that a pope should resign if he "clearly realizes that he is no longer physically, psychologically, and spiritually capable of handling the duties of his office, then he has a right and, under some circumstances, also an obligation to resign."
But if it is simply a staggering burden to be pope, Benedict said, "One must stand fast and endure the situation. That is my view. One can resign at a peaceful moment or when one simply cannot go on. But one must not run away from danger and say someone else should do it."
The last pope to resign was Gregory XII in the 15th Century. And the most infamous may have been Pope Celesine V who quit in 1294. "Dante placed him in hell for it," says political scientist and Vatican expert Rev. Thomas Reese.
Popes who have resigned - often during times of political turmoil:
Pontian (230-235). Allegedly resigned after being exiled to the mines of Sardinia.
Marcellinus (296-304). Abdicated or was deposed after complying with Roman Emperor Diocletian's order to offer sacrifice to pagan gods.
Martin I (649-655). Exiled by Emperor Constans II to Crimea.
Benedict V (964). Elected after the assisination of the prior pope, he was pushed out a month later, by the emperor, who favored a different candidate.
Benedict IX (1032-45). Resigned after selling the papacy to his godfather Gregory VI.
Gregory VI (1045-46). Deposed by Henry III for simony (selling Church pardons and offices).
Celestine V (1294). A hermit, elected at age of 80 and overwhelmed by the office, resigned. He was imprisoned by his successor.
Gregory XII (1406-15). Resigned to help end the Great Western Schism when there were multiple rival popes.
Sources: Rev. Thomas Reese, Papal Transition; Patrick Granfield, Papal Resignation (1978) and J. N. D. Kelly, The Oxford Dictionary of Popes (1986).