"Thy God whom thou servest continually, he will deliver thee." Dan. 6:16. King Darius' words to Daniel are genuine; nonethless, he's forced to face the fact that his high-ranking officer has committed a crime and is now facing the punishment of death.
But it's actually Daniel's colleagues who have framed him. Darius was prepared to promote Daniel to the position of supervisor over the land, so the other royal officers decide to do away with Daniel by introducing legislation that will condemn to death whoever prays to anyone other than the king. Darius agrees to the decree, only to realize later that it affects Daniel.
As the familiar story goes, Darius' benediction to Daniel does come to pass, and an angel rescues Daniel from being eaten by the lions. Daniel declares that God has preserved him because he has done nothing to offend either God or the king. Daniel puts his dedication to God ahead of everything and everyone else, despite the inevitable punishment. This dedication to God is a theme throughout Daniel's life.