Line of Duty creator Jed Mercurio has said he would have killed off one of the show's three main characters if their actors had not got on.
Mercurio, who is also behind the BBC's hit drama Bodyguard, is known for suddenly and brutally writing characters out of his series.
He said he would have killed either DC Steve Arnott, DI Kate Fleming or Superintendent Ted Hastings if the trio had not clicked on set.
That would mean one of the programme's well-loved ensemble - Martin Compston, Vicky McClure and Adrian Dunbar - would have faced being axed.
Speaking during the recording of South Bank Live in London, Mercurio said it was "no accident" the show had kept the same three leads over five series.
He said: "I think it's no accident that we have the same three leads. They are really good actors.
"But also they get on really well with each other. They all get on very well.
"And if that hadn't happened one of them would have been killed off in a completely unexpected way to propel the story forward.
"I'm in a very fortunate position of being a show-runner, so I am very involved in the cast and casting."
He appeared on a panel with Inside No. 9's Reece Shearsmith and Steve Pemberton, and Call The Midwife writer Heidi Thomas.
Mercurio also explained how he decided which characters to kill, and which to spare.
"It's always got to be about what is in the best interest of the series," he said.
"Clearly it is not in the best interest of a character to be dead," he added, laughing.
"The way I would approach it is to look at what new story you get from that.
"And if the audience has got a real attachment to a character it means that they are then invested in whether there will be justice for that character or whether there will be a mystery around it.
"They will be invested in finding out what might have actually befallen them."
The event was held to promote the new series of The South Bank Show which begins on July 16 at 10.00pm on Sky Arts and Now TV.