Image caption Richard Madden is assigned to protect Keeley Hawes in Bodyguard

BBC One's thriller Bodyguard fought off ITV's new period drama Vanity Fair in Sunday's TV ratings, attracting more than twice as many people as its rival.

The shows went head-to-head at 21:00 BST.

The third episode of Bodyguard was seen by an average of 6.6 million viewers, according to overnight figures.

The launch of Vanity Fair averaged 2.9 million. It followed The X Factor, whose ratings fell from 5.7 million on Saturday to five million on Sunday.

Image copyright ITV Image caption Olivia Cooke plays Becky Sharpe, with Tom Bateman as Captain Rawdon Crawley in Vanity Fair

Vanity Fair, based on William Makepeace Thackeray's 19th Century novel, has been billed as the programme to fill the gap left by Downton Abbey on ITV.

It stars Olivia Cooke, who acted in Steven Spielberg's Ready Player One before playing Thackeray's ambitious protagonist Becky Sharp.

ITV's director of television Kevin Lygo recently said Vanity Fair came about partly because it's his mother's favourite book, and that he originally wanted a more famous actress to play the lead.

"I wanted Emma Watson or someone everyone would have known," he told the Edinburgh Television Festival last month.

"But Olivia will be known. She is absolutely brilliant in this and mesmerising and it's so flamboyantly directed. I think it's just fun and flashy and a huge budget for us, and I'm really excited."

Image copyright Tom Dymond/Thames/Syco Image caption The X Factor launch saw new judge Robbie Williams duet with Andy Hofton

Speaking about what ratings he would expect any drama on the channel to register, he said: "If they're only going to get 2.5 million viewers, that's not right for us. Our drama needs to be broad by definition, it needs to be impactful."

Vanity Fair is up against Bodyguard, which stars Richard Madden as an officer assigned to protect the home secretary, played by Keeley Hawes.

Its ratings have stayed flat - its first two episodes last Sunday and Monday attracted 6.7 and 6.4 million respectively in the overnight ratings.

Meanwhile, the 15th series of X Factor began with an audience of 5.7 million on Saturday - down on the six million who tuned in to watch the launch show last year.

That means Saturday's ratings were the lowest for a launch night since the programme started in 2004, when 4.9 million watched the opening episode.

ITV's overnight ratings include those watching the channel live and an hour later on ITV+1.

Follow us on Facebook, on Twitter @BBCNewsEnts, or on Instagram at bbcnewsents. If you have a story suggestion email entertainment.news@bbc.co.uk.