The Prophecy of Seventy Weeks (chapter 9 of the Book of Daniel) tells how a prophecy was given to Daniel by the angel Gabriel subsequent to the former's prayer that God would act on behalf of his people and city, which are respectively in exile and remain desolate within the narrative setting of this chapter. The prophecy has proved notoriously difficult for readers, despite the fact that it has been the subject of "intense exegetical activity" since the Second Temple period. For this reason scholars continue to follow James Alan Montgomery in referring to the history of this prophecy's interpretation as the "dismal swamp" of critical exegesis.
Daniel reads in the "books" that the desolation of Jerusalem must last for seventy years according to the prophetic words of Jeremiah, and prays for God to act on behalf of his people and city. The angel Gabriel appears and tells Daniel that he has come to give wisdom and understanding, for at the beginning of Daniel's prayer a "word" went out and Gabriel has come to declare this revelation:
24"Seventy weeks are decreed for your people and your holy city: to finish the transgression, to put an end to sin, and to atone for iniquity, to bring in everlasting righteousness, to seal both vision and prophet, and to anoint a most holy place. 25Know therefore and understand: from the time that the word went out to restore and rebuild Jerusalem until the time of an anointed prince, there shall be seven weeks; and for sixty-two weeks it shall be built again with streets and moat, but in a troubled time. 26After the sixty-two weeks, an anointed one shall be cut off and shall have nothing, and the troops of the prince who is to come shall destroy the city and the sanctuary. Its end shall come with a flood, and to the end there shall be war. Desolations are decreed. 27He shall make a strong covenant with many for one week, and for half of the week he shall make sacrifice and offering cease; and in their place shall be an abomination that desolates, until the decreed end is poured out upon the desolator." (verses 24-27, NRSV)
It is generally accepted among modern critical scholars that chapters 1-6 in the Book of Daniel originated as a collection of folktales among the Jewish diaspora in the Persian/Hellenistic periods, and were later expanded with the more visionary material of chapters 7–12 during the persecution under Antiochus IV in 167–163 BCE. The same critical consensus also maintains that the stories about Daniel and his friends are legendary, and that the eponymous hero of this biblical book "most probably never existed." There are references to a person named Daniel in earlier texts: a priest named Daniel accompanies Ezra from Babylon to Jerusalem in Ezra 8:2, a person named Daniel known for his righteousness and wisdom is alluded to in Ezekiel 14:14 and 28:3, and there is also a king named Daniel in the Ugaritic corpus. However, there is no straightforward connection between these figures and the legendary Hebrew prophet named Daniel.