During Sunday night’s episode of the BBC One series, DSU Ian Buckells, played by Nigel Boyle, was unmasked as the mysterious H, the corrupt police officer at the top of a criminal conspiracy.
The series creator, 55, revealed he included a hint that Buckells was not what he seemed back in 2012.
He said the fact that Buckells allowed caddy Dot Cottan - played by Craig Parkinson - to speak with criminal Tommy Hunter - played by Brian McCardie - in the back of a van was proof that he was a bent officer.
Mercurio also explained it was “really important” for him that a character who had been involved from the start was H for viewer satisfaction.
Watch: Spoilers! Amazon Alexa's opinion as 'Line of Duty' reveals true identity of H
The writer told the Obsessed With Line of Duty podcast: “It was always really important to me that it was someone who had been in season one, someone who had been there the whole time.
“We did introduce some characters late, so Thurwell came in late, we went back to Fairbank, who’d appeared in season three, we had the Chief Constable, who had obviously been there since season one.
“But then I don’t think he would have been a satisfying candidate because he had been absent for so long, it would feel like we’d just brought him back in to pin it on him.”
He continued: “It was really about the heritage of the series, going all the way back to season one, where Dot Cottan says, ‘Oh, can I just have a quick word with Tommy Hunter in the back of the van?’ and Buckells goes, ‘Yeah, alright’. OK, like, really, is that what you should be doing? Of course, not.”
It comes after Mercurio and the stars of Line Of Duty said they would get matching tattoos after the series finale earned more than 12 million viewers.
Martin Compston, who plays Steve Arnott, revealed that he, Adrian Dunbar (Ted Hastings), Vicky McClure (Kate Fleming) and Mercurio had agreed to get “AC12million” tattoos if the show hit the milestone.
He joked that it was an “inconceivable and ridiculous scenario”.
The much-anticipated episode was watched by an average of 12.8 million people, with a 56.2 per cent share in overnight viewing figures, making it the most watched episode of a drama in 20 years, the BBC said. The episode also had a peak viewing figure of 13.1 million.
Watch: Martin Compston shares Line of Duty pranks with co-star Vicky McClure