Media playback is unsupported on your device Media caption The Christmas episode is called Twice Upon A Time and features the return of Pearl Mackie as Bill Potts.

Details of Peter Capaldi's final outing in Doctor Who have been revealed as the first trailer for the Christmas special was released online.

The one-minute clip for the episode, titled Twice Upon A Time, sees Capaldi and the First Doctor team up.

It features the return of Pearl Mackie as Bill Potts, who had seemingly left the show at the end of series 10.

The clip also showed a guest appearance from Mark Gatiss, who plays a World War One soldier called The Captain.

The release of the trailer coincided with the cast appearing at Comic-Con in San Diego on Sunday, where they talked about the upcoming episode, the last series and looked back at Capaldi's time on the sci-fi drama.

Image copyright Getty Images

Gatiss described the Christmas special as being "a Christmas episode without being overtly Christmassy - it's very happy-sad".

He added: "[It's] a fantastic episode and we had a great time doing it. It was a lovely way out."

It will be the third time the Sherlock actor and writer has appeared on Doctor Who, after previously starring in episodes in series three and six.

Mackie also confirmed the festive episode will be her last appearance on the show.

Analysis - Lizo Mzimba, Entertainment correspondent

Twice Upon a Time is the final episode for Peter Capaldi's Twelfth Doctor and for outgoing showrunner Steven Moffat. Both have been huge Doctor Who fans for most of their lives, and their final story is clearly a love letter to a show that means a huge amount to both.

This first trailer begins with original footage of the First Doctor, William Hartnell, from 1966's The Tenth Planet (episode two if you're interested), which then mixes through to David Bradley who plays him in this story.

But it also shows a glimpse of a scene with the First Doctor and his assistant Polly from episode four - Hartnell's final episode before Patrick Troughton took over. Sadly that episode is one of the dozens that are still missing from the BBC archives.

The minute-long teaser also makes clear that this Christmas story won't just be accessible to long term fans. Bill will be back, after she was last seen heading off to travel the universe with student-turned-space and time traveller Heather.

The trailer also shows actor and writer Mark Gatiss making another Doctor Who appearance. In 2007 he played Professor Lazarus, and he also briefly popped up playing a different character in 2011.

Comic-Con fans were shown a three-minute goodbye video for Capaldi, thanking him for his time on the show, which led to a standing ovation.

The actor praised writer and executive producer Steven Moffat, saying: "Every shot you saw there came through his gentleman's mind. The message of the show comes from his heart."

Image caption Whittaker was announced in a trailer on BBC One after the Wimbledon men's final

The team also addressed the casting of Jodie Whittaker as the Thirteenth Doctor and first female to take on the role.

Capaldi called it "a great choice", adding: "I think Jodie's going to be amazing and she's so full of excitement and full of passion about the show.

It's really thrilling to know it's in the hands of somebody who cares for it so deeply and is going to do exciting things with it."

Meanwhile, Moffat criticised the "imaginary backlash" in the media on the issue.

"There's so many press articles about a backlash among Doctor Who fandom against the casting of a female Doctor. There has been no backlash at all," he said.

"[Jodie has] an 80% approval rating on social media. I wish every single journalist who is writing the alternative would shut the hell up - it's not true."

The outgoing writer and executive producer also cleared up the issue of whether the character's name is Doctor Who or the Doctor.

"There isn't any doubt about it, I'm sorry," Moffat said. "It was established in The War Machines (episode) that his name is Doctor Who."

He provided evidence to back up his point, including signing letters "Doctor W" and the third Doctor having a "Who" licence plate.

"He doesn't often call himself Doctor Who because it's a bloody stupid name," Moffat added.

On Saturday, Capaldi told Empire he was both sad to be leaving the series and excited for its future.

"[The Christmas special] is a wonderful episode and I couldn't have wanted for any more.

"It's an emotional and moving end to my time as Doctor Who."

More from Comic-Con

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