In the third year of the rule of Judah's King Jehoiakim, Babylon's King Nebuchadnezzar came to Jerusalem and attacked it.
The Lord handed Judah's King Jehoiakim over to Nebuchadnezzar, along with some of the equipment from God's house. Nebuchadnezzar took these to Shinar, to his own god's temple, putting them in his god's treasury.
Nebuchadnezzar instructed his highest official Ashpenaz to choose royal descendants and members of the ruling class from the Israelites—
good-looking young men without defects, skilled in all wisdom, possessing knowledge, conversant with learning, and capable of serving in the king's palace. Ashpenaz was to teach them the Chaldean language and its literature.
The king assigned these young men daily allotments from his own food and from the royal wine. Ashpenaz was to teach them for three years so that at the end of that time they could serve before the king.
Among these young men from the Judeans were Daniel, Hananiah, Mishael, and Azariah.
But the chief official gave them new names. He named Daniel "Belteshazzar," Hananiah "Shadrach," Mishael "Meshach," and Azariah "Abednego."
Daniel decided that he wouldn't pollute himself with the king's rations or the royal wine, and he appealed to the chief official in hopes that he wouldn't have to do so.
Now God had established faithful loyalty between Daniel and the chief official;
but the chief official said to Daniel, "I'm afraid of my master, the king, who has mandated what you are to eat and drink. What will happen if he sees your faces looking thinner than the other young men in your group? The king will have my head because of you!"
So Daniel spoke to the guard whom the chief official had appointed over Daniel, Hananiah, Mishael, and Azariah:
"Why not test your servants for ten days? You could give us a diet of vegetables to eat and water to drink.
Then compare our appearance to the appearance of the young men who eat the king's food. Then deal with your servants according to what you see."
The guard decided to go along with their plan and tested them for ten days.
At the end of ten days they looked better and healthier than all the young men who were eating the king's food.
So the guard kept taking away their rations and the wine they were supposed to drink and gave them vegetables instead.
And God gave knowledge, mastery of all literature, and wisdom to these four men. Daniel himself gained understanding of every type of vision and dream.
When the time came to review the young men as the king had ordered, the chief official brought them before Nebuchadnezzar.
When the king spoke with them, he found no one as good as Daniel, Hananiah, Mishael, and Azariah. So they took their place in the king's service.
Whenever the king consulted them about any aspect of wisdom and understanding, he found them head and shoulders above all the dream interpreters and enchanters in his entire kingdom.
And Daniel stayed in the king's service until the first year of King Cyrus.