Game of Thrones ended by making A Song Of Ice And Fire canon, thanks to Samwell Tarly. The hit HBO fantasy show is based on George R.R. Martin's book series, the first of which is called A Game of Thrones. The whole series, however, is titled "A Song Of Ice & Fire."

The title itself has many meanings (just as the show's wound up having). It refers to the mystical battle between dragons and white walkers, the prominence of Targaryens and Starks, of Jon Snow's parentage (he's the son of Rhaegar and Lyanna, members of those respective families), and even more abstract ideas. While it had never been spoken in the series, the idea took on a lot of importance.

Related: Game Of Thrones: Everybody Who Survived The Show

This was hammered home in Game of Thrones' series finale when Sam presented the new small council with a book titled A Song Of Ice And Fire, written by Archmaester Ebrose (Jim Broadbent) that charts the battles following the reign of King Robert Baratheon: aka, the story of Game of Thrones. This made the story we were being told canon, albeit with something of a twist.

Sam in the crypts of Winterfell in Game of Thrones

The theory that Sam would be involved in the writing of a fourth-wall-breaking book has been a popular one amongst Game of Thrones fans for years. Indeed, back in season 7, Ebrose's book was referenced, with his admitting he didn't have a good title. The finale confirms that is supposed to be the story we're being told.

Of course, fans of fantasy had other reason to suspect this twist. Game of Thrones' author George R.R. Martin is heavily inspired by The Lord of the Rings, which ends with Bilbo and Frodo Baggins writing their adventures as books, implied to be identical to J.R.R. Tolkien's real-life works. Just as Daenerys' descent into madness mirrors the scouring of the Shire, so too does Sam's A Song Of Ice And Fire fall in line with the ending of both the Baggins' family and his namesake, Samwise Gamgee.

However, the A Song Of Ice And Fire book seen in Game of Thrones' finale isn't quite accurate to what George R.R. Martin wrote. Not only did Ebrose write it before the final battles of Winterfell and King's Landing, per Sam it doesn't include a single reference of major player Tyrion. This may even be a jab at Martin, who has repeatedly stated that Tyrion is his favorite character.

Related: Game of Thrones: Where Drogon Went With Dany's Body

The A Song of Ice and Fire reference isn't quite as tight as some may have expected, but it's incredibly gratifying that Game of Thrones made the time to work it into a packed finale.

Next: Where Arya Is Going In Game Of Thrones: What's West Of Westeros?