Daniel 5:1-4 describes "Belshazzar's Feast" in which the sacred vessels of Solomon's Temple in Jerusalem, which had been brought to Babylon by Nebuchadnezzar at the time of the Captivity were profaned by the company. The narrative unfolds against the background of the impending arrival of the Persian armies.

"King Belshazzar gave a great banquet for a thousand of his nobles and drank wine with them. While Belshazzar was drinking his wine, he gave orders to bring in the gold and silver goblets that Nebuchadnezzar his father had taken from the temple in Jerusalem, so that the king and his nobles, his wives and his concubines might drink from them. So they brought in the gold goblets that had been taken from the temple of God in Jerusalem, and the king and his nobles, his wives and his concubines drank from them. As they drank the wine, they praised the gods of gold and silver, of bronze, iron, wood and stone." 

In consequence of this, during the festivities, a hand was seen writing on the wall of the chamber a mysterious sentence mene mene tekel upharsin, which defied all attempts at interpretation. Some Rabbinic interpertations (notably the mention in the Babylonian Talmud) say that the words were written in code, one possibility was that it was an atbash cipher. Still, their natural denotations of weights and measures were superficially meaningless: "two minas, a shekel and two parts.". In the verb form, they were: mene, to number; tekel, to weigh; upharsin, to divide - literally "numbered, weighed, divided". When the Hebrew Daniel was called in, he read and interpreted the words.

And this is the writing that was inscribed: MENE, MENE, TEKEL, and PARSIN. This is the interpretation of the matter: MENE (literally a "monetary toll"), God has numbered the days of your kingdom and brought it to an end; TEKEL (literally a "tokenary weight"), you have been weighed on the scales and found wanting; PARSIN (literally a "division" or "portion"), your kingdom is divided and given to the Medes and Persians.

 The last word (prs) he read as peres not parsin. His free choice of interpretation and decoding revealed the menacing subtext: "Thou art weighed in the balance and art found wanting". The divine menace against the dissolute Belshazzar, whose kingdom was to be divided between the Medes and Persians, was swiftly realized: in the last verse we are told that Belshazzar was slain in that same night, and that his power passed to Darius the Mede.

This Biblical story is the source of the popular phrase "the writing on the wall" as a euphemism for impending doom that is so obvious only a fool would not see it coming. It also provides the origin for the similar expression "your days are numbered."