The image showed Prince Harry with a pistol to his head against a blood-spattered background and also featured a blood-smeared swastika.
It was shared in a neo-Nazi social media group in August last year, just a few months after the duke married mixed-race former actress Meghan Markle.
The BBC featured the image in a broadcast and on its website, which subsequently led to the prosecution of two far-right teenagers.
Watchdog Ofcom rejected a complaint from Harry about the use of the image, but has offered an apology to the senior royal.
A BBC source said: “This was an important piece of journalism which led to the arrest, conviction and imprisonment of two members of a neo-Nazi group.
“The image of the Duke of Sussex was included to show the abhorrent nature of their behaviour and Ofcom has subsequently concluded that there was a clear editorial rationale for using the image which, in the context of the news report, was considered unlikely to incite crime.
“Naturally we regret the distress caused and we apologised for failing to warn Kensington Palace in advance that it was to be published.”
After the report, university student Michal Szewczuk, 19, from Leeds - who created the image with the phrase “see ya later race traitor”, pleaded guilty to two counts of encouraging terrorism and five counts of possession of terrorist material, including the White Resistance Manual and the Al Qaeda Trading Manual.
He was ordered to be detained in a young offenders’ institution.
Eighteen-year-old Oskar Dunn-Koczorowski, from St Albans Avenue, in west London, also admitted two counts of encouraging terrorism.
Rejecting the complaint in July, Ofcom said showing the image was editorially justified.
The judgment said: “When broadcasting or publishing examples of racist propaganda in content with a clear public interest, there are nevertheless limits on the type of material which can be included, taking into account generally accepted standards in particular.
“The BBC demonstrated in this case that it made a finely balanced decision on the necessary editorial justification to include the image and removed it from the article two days after publication when it considered that the public interest in the story had reduced.”
A spokeswoman for Harry said he welcomes the letter of apology from the BBC, but added: “His Royal Highness maintains that instead of reproducing the image and giving a platform to something that would have only been seen by a few, it should have just been described so that others would not potentially be influenced by such an inflammatory image.”
Press Association contributed to this report.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies