A bomb in Londonderry was an attempt by dissident republican group the New IRA to murder police officers, the PSNI has said.
The bomb was found after up to 80 police officers took part in a security search targeting the New IRA on Monday.
Fifteen families had to leave their homes after the discovery of the device in Creggan Heights, but they have since returned home after it was made safe.
Police said the bomb “would have killed or maimed anyone near it”.
More than 40 petrol bombs and other missiles were thrown at police during the security search.
Police said a crowd of between 60 and 100 young people confronted officers and at least two of the young people suffered burn injuries when they tried to attack the police cordon with petrol bombs.
No police officers were injured.
Assistant Chief Constable Mark Hamilton said the command wire initiated improvised explosive device was discovered in a car parked in the area.
He said it contained commercial explosives and was in an “advanced state of readiness.”
It was made safe by Army bomb disposal experts at about 04:00 BST.
‘No regard for life’
ACC Hamilton said officers believed the bomb was to be used against a police patrol in the area.
“This is not a car bomb, it is a smaller device but could have had really devastating consequences,” he said.
Those responsible had “no regard for the lives of anyone living in Creggan” and had “exploited some of the young people in the community to attack police”, he added.
Police said they would remain at the scene and a “full terrorist investigation” was under way.
Sinn Féin’s Karen Mullan said people living in Creggan were “angry and disgusted” and those responsible were not “listening to the community”.
“There is no justification whatsoever for rioting or attacking the police when they are in to do their job,” she said.
Journalist Lyra McKee was shot dead during rioting in Creggan in April while standing near a police 4×4.
Fr Joseph Gormley, who anointed Ms McKee on the night she was shot, said had the bomb not been found and diffused, “we could have had another loss of life”.
The New IRA later said its members had murdered the 29-year-old, who was shot in the head when a masked gunman fired towards police and onlookers.
Monday’s police operation in Creggan followed the discovery of a mortar bomb in Strabane, County Tyrone, on Saturday, which police blamed on the New IRA.