Spoiler Alert - This article contains storylines from The Final Problem episode.

Image copyright BBC/Hartswood Films Image caption The series was the fourth outing for Benedict Cumberbatch and Martin Freeman in Sherlock

The series finale of BBC One's Sherlock drew its lowest-ever overnight UK ratings on Sunday night.

Around 5.9m tuned in to watch Benedict Cumberbatch in The Final Problem, down from the 8.1m who watched the first episode on New Year's Day.

However, consolidated figures from those who recorded the show and watched it later has bumped the figure to 9.5m.

The BBC says it is investigating how the episode was leaked online before it was broadcast on TV.

The last instalment of the fourth series was screened on BBC One on Sunday evening hours after a Russian language version emerged online.

'Full investigation'

It featured a brief continuity announcement linking it to Russia's Channel One, which owns the rights to show Sherlock in Russia.

A spokesman said: "BBC Worldwide takes breaches or our stringent content security protocols very seriously and we have initiated a full investigation into how this leak occurred."

The Russian television channel claims it was the victim of hacking by "an unauthorised external third party".

Channel One issued a statement saying they have been cooperating with BBC Worldwide's investigation.

"We are doing everything in our power to determine the source of the breach. Initial investigations suggest our content system was compromised by an unauthorised external third party.

"Channel One Russia will share the results of our investigation with the media as soon as it has concluded."

They also apologised "for any inconvenience this leak has caused".

The series was the fourth outing for Sir Arthur Conan Doyle's famous detective, played by Cumberbatch, and starring Martin Freeman as Dr John Watson.

Sherlock's nemesis Moriarty, played by Andrew Scott, made his return as part of a flashback sequence which saw him team up with Sherlock's secret sister, Eurus, before he died.

Eurus, played by Sian Brooke, and Moriarty enticed the detective, Dr Watson and Sherlock's brother Mycroft into a series of games.

Writer Steven Moffat has fuelled speculation that The Final Problem could be the last ever Sherlock.

He said: "We're not planning it to be (the final), but it might be. We could end it there. We couldn't have ended it on any of the previous series because they always ended in walloping great cliff-hangers, usually by Andrew."

The episode, which also featured a cameo appearance by singer Paul Weller, received mixed reviews from the critics.

Michael Hogan wrote in the Daily Telegraph "if this was the last-ever episode, which it surely won't be, it worked well as a sign-off".

"Last night's episode showcased all the elements that have made this modern-day reinvention such a hit - as well as those that have proved divisive."

He gave it five stars and called it "an exhilarating thrill-ride".

But Christopher Stevens in The Daily Mail gave it no stars and said that the episode was "an abject, flailing, noxious mess", "shockingly bad" and "self-indulgent rubbish".

"If you've woken up this morning with the angry feeling that you were robbed of an evening's entertainment, I share your sense of betrayal. Sherlock was, quite simply, the most nonsensical, verbose piece of television I've ever sat through," he wrote.

More than 11 million viewers watched the episode broadcast on New Year's Day once consolidated figures were taken into account, making it the biggest audience of the festive period.

The ratings for The Final Problem are likely to rise again when the on-demand audience is taken into account. The full consolidated ratings figures will be published next week.