I received the quest in which I am charged with taking my religion's holy city from the civ with which I was at war. It said I would fail the quest if peace was declared, if another civ captured the city, or if I changed state religion. Neither of these things happened. I captured the holy city, completing the quest perfectly. Yet, on the next turn, I was informed that the quest had failed. A bug, if I ever saw one.