'Doctor Who' writer Sarah Dollard was pleasantly surprised when she was told she would have the responsibility of killing off companion Clara Oswald in 'Face the Raven'.

Jenna Coleman with Steven Moffat

Jenna Coleman with Steven Moffat

Viewers were left shocked when Clara - played by Jenna Coleman - took her final breath in the episode that aired last Saturday (21.11.15) as she was killed by the Quantum Shade spirit leaving the Doctor angry and alone.

And that same feeling of shock washed over Sarah when she was informed by showrunner Steven Moffat he wanted Clara to die in the story she had constructed for her first ever 'Doctor Who' episode and that it would kick off the three-part finale.

In an interview with website Blogtor Who (blogtorwho.blogspot.co.uk), the Australian screenwriter - who has worked on 'Neighbours' and 'Merlin' - revealed: "I'd done a complete first draught (of my episode) and that was read by everybody. I came in for second draft meeting and sat there at the table and Steven said, 'Good news is, we really love it. We love it so much, we'd like to talk about putting at this point in the season where it can form the part of an arc.

"They told me about Ashildr (played by Maisie Williams), I was like, 'Awesome.' And then I spilt my water all over the table as we talked about Clara and at that point I don't think Steven knew for absolute certain exactly what he was going to do with her end. Certainly death was being talked about but he wasn't sure if it was going to be in (episode) ten or in twelve.

"So in that meeting it was decided I would be given the chance to write that script ... I think that was putting a lot trust in a writer they didn't completely know. It was still in a state of flux until they read what I'd done but they liked it so it was fine. I felt like, 'He's putting a lot of trust in me, so that's great!' "

Steven has also revealed Jenna was originally going to be written out of 'Doctor Who' in the 2014 Christmas special as she had told him she wanted to leave at the end of Series 8 but he and Peter Capaldi - who plays the titular Time Lord - convinced her to stay on for Series 9 this year.

He said: "I wrote her out of the end of Christmas but I wrote two endings ... At the read through we did the big heart-rending departure and she changed her mind ... Peter and I did perform every form of emotional manipulation known to people on the world tour, badly and ineptly I might add. I like to think in the sheer ineptitude of our apparent subterfuge we were charming."

Steven believes her death in 'Face the Raven' was the perfect exit for the 29-year-old actress, who had been the Doctor's fellow TARDIS traveller for four years.

He added: "It was the right way for her to go, in my view."

'Doctor Who' continues this Saturday (28.11.15) with 'Heaven Sent'.