The pair were convicted of the murder of A-level student Aamir Siddiqi, 17, who was stabbed to death in April 2010 in front of his mother Parveen and father Iqbal at their home in Cardiff.

Aamir's parents were both injured as they tried to stop Hope and Richards attacking their son.

The two men were convicted at Swansea Crown Court in February 2013 of murdering Aamir and of attempting to murder each of his parents.

Lord Thomas said today that Richards' conviction was "entirely safe".

Dismissing the sentence challenges by the pair, he said: "In our judgment the length of the minimum term rightly reflected the entire criminality of the appellants' conduct.

"This was an appalling series of crimes for which the minimum term of 40 years was just punishment, reflecting not only the premeditated and brutal nature of the murder and attempted murders but also a deterrent element in respect of contract killings which have no place in any civilised society."

The appeals were heard in Cardiff and Lord Thomas announced the court's decision in London today.

In a written judgment, he said that the two men, who were wearing balaclavas and wielding knives, forced their way into a family home in Ninian Road, Cardiff, where they "brutally attacked and killed Aamir".

He added: "As Aamir's parents made valiant and desperate attempts to protect their son, they were also viciously attacked and stabbed.

"It subsequently emerged that the two men were contract killers who, by grotesque mistake, had gone to the wrong house.

"The evidence was that they had been engaged by a local drug dealer, to whom we shall refer as XD, to kill a person who lived in a house in an adjoining street."