Daniel decided not to make himself "unclean" by eating the king's food and drinking his wine. So he asked the chief official for a favor. He wanted permission not to make himself "unclean" with the king's food and wine.
God had caused the official to be kind and friendly to Daniel.
But the official refused to do what Daniel asked for. He said, "I'm afraid of the king. He is my master. He has decided what you and your three friends must eat and drink. Why should he see you looking worse than the other young men who are the same age you are? When he sees how you look, he might kill me."
So Daniel spoke to one of the guards. The chief official had appointed him over Daniel, Hananiah, Mishael and Azariah.
Daniel said to him, "Please test us for ten days. Give us nothing but vegetables to eat. And give us only water to drink.
Then compare us with the young men who eat the king's food. See how we look. After that, do what you want to."
So the guard agreed. He tested them for ten days.
After the ten days they looked healthy and well fed. In fact, they looked better than any of the young men who ate the king's food.
So the guard didn't require Daniel and his friends to eat the special food or drink the wine. He gave them vegetables instead.