Police officer Keith Blakelock was stabbed to death by an armed mob yelling "kill the pig" during the 1985 Broadwater Farm riots, a court has heard.
Nicholas Jacobs, 45, is accused of murdering Pc Blakelock, 40, as the officer tried to protect firefighters tackling a blaze at the height of the unrest in Tottenham, north London.
Opening the prosecution at the Old Bailey, Richard Whittam QC said the riots of 1985 were more "sinister" than the later ones in Tottenham in 2011.
Mr Whittam said the attack on Blakelock "was without mercy".
TOP STORIES TODAY
They erupted the day after Cynthia Jarrett, a mother of a police suspect, had a heart attack and died when her home was searched in Thorpe Road, Tottenham.
Mr Whittam said: "At least some of the rioters in 1985 appeared to have as their target the death of a police officer.
"Whether that was their primary objective is not something that you will have to decide. The fact is that one police officer was killed and another very seriously injured."
Pc Blakelock was among a group of uniformed officers sent out without cover on the night of Sunday October 6 1985 to protect firemen putting out blazes.
They came across a "very large group" of rioters, many armed with an assortment of weapons, the court heard.
"Very heavily outnumbered and fearful they may become trapped both the police and the firefighters were forced to retreat.
Outside the flats, as they ran for safety, Pc Blakelock and Pc Richard Coombes went to ground and were set upon to shouts of 'kill the pig' and the like."
"Pc Coombes was very fortunate to survive. Pc Blakelock did not. The attack on him was without mercy. In the ferocious attack his helmet came off.
"He was beaten and stabbed to death before his colleagues were able to force the attackers away.
"Pc Blakelock suffered something in excess of 40 stab type injuries and there appears to have been an attempt made to decapitate him."
Jacobs denies the murder.
The court heard that Jacobs was 16, almost 17, at the time of the attack, which followed weeks of tension and concerns that "individuals were planning public disturbances" in the borough of Haringey.
On Saturday October 5 1985 a man was arrested in Tottenham in connection with a suspected stolen vehicle tax disc.
When officers attended the man's home address his mother, Mrs Jarrett, died from a heart attack, "fuelling further the existing community tensions".
"Many members of the local community believed that the police were responsible for the death," Mr Whittam told the jury.
"The anger and grief of the family and friends of Mrs Jarrett spread to other members of the community and a demonstration was planned to take place outside Tottenham police station on Sunday October 6."