Peter Jackson has found the right person to give “The Hobbit: The Desolation of Smaug” a fitting closing song. British singer Ed Sheeran had to fly to Wellington to write and record a song, as well as learn to play a violin in just one day, for the highly anticipated film.

As a tradition applied in Jackson’s J.R.R. Tolkien films, the Kiwi filmmaker deemed it important the new film would also have a song over the closing credits. The song not only has to feel right, but should also carry the emotional resonance of the end of the film.

“It’s always tricky to think of the right person to create and performance (sic) these songs. Someone who shares our passion for Tolkien, and somebody who is prepared to respect the film,” Jackson wrote on his Facebook page.

And he found that someone in Sheeran, thanks to his daughter Katie’s recommendation.

“I wrote to him on a Sunday morning, and asked if he was interested. He would need to fly down to NZ to see the movie, because it was critical he write from the perspective of the audience,” the director explained.

48 hours later, the 22-year-old singer-songwriter landed in Wellington and watched the yet-to-be released second instalment of “The Hobbit.”

“Ed watched the movie at Park Road Post, immediately went into a room, and started writing and singing. Much of what you will hear on this song was recorded that same day, with a few overdubs and tweaks the following day.

“Despite having never played the violin in his life, Ed thought he might try overdubbing one himself, and Katie raced out to borrow a rather battered one from a school friend,” Jackson continued.

In the end, the young singer was able to create a masterpiece titled “I See Fire” in just a very short period of time.

“It was a great experience, and what you will see in this video are moments captured by our behind the scenes team during the creation of the song. But the images are only supporting Ed’s wonderful song. This is his direct emotional response to seeing The Desolation of Smaug, written and performed on the same day he saw the movie.”

Sheeran was also excited to compose and perform the song to the film.

“I got the chance to produce and play all the instruments on it apart from the cello. Managed to learn violin for a day, hope you all dig it,” Sheeran announced the online release of his song on Twitter.

“Big up Peter Jackson and his team for giving me the opportunity.”

“The Hobbit: The Desolation of Smaug” is the second instalment of the three-part film series based on Tolkien’s novel “The Hobbit.” It stars Iam McKellen, Martin Freeman, Richard Armitage, Benedict Cumberbatch, Evangeline Lilly, and Orlando Bloom among many others.

The film will be released in New Zealand on December 12.