Sounds alot like The Adventures of baron Munchausen
Haven't seen it yet, but from the summary it sounds like the plot to The Adventures of baron Munchausen. In that movie, a town is being sieged, and the crowd is panicking, then this Old guy starts telling a story of his adventures with his amazing friends, to a little girl so she wont be scared.
In the end it turns out that his story is really happening and the town is saved.