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.
Police said the device contained commercial explosives.
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.
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 gathered in the area, some of whom attacked police vehicles.
At least two of the young people suffered burn injuries when they tried to attack the police cordon with petrol bombs.
Sinn Féin’s Karen Mullan said the number of young people who actively attacked police was “smaller” than the total size of the crowd.
“I didn’t see anything orchestrated but one person rioting is one person too many,” she added.
She 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.
No police officers were injured.
‘Advanced state of readiness’
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 was in an “advanced state of readiness.”
The device would require someone to be “standing watching for a target to pass by” and then send an electrical charge down its command wire.
“This is effectively like a roadside bomb,” he said.
“It’s a small device to look at but contains what we believe to be commercial explosives and it would have had quite a considerable explosion.”
It was made safe by Army bomb disposal experts at about 04:00 BST.
The PSNI has noted a change of tempo in dissident Republican activity in recent months.
Senior officers believe there is a greater determination to cause harm.
Perhaps dissident Republicans are out to exploit publicity surrounding Brexit.
This year, there have been seven attacks, or planned attacks, in Northern Ireland which are known of.
The majority have been attributed to the so-called New IRA, the bigger of two main dissident groups.
None of the attacks has gone to plan – only two of six murder bids involving bombs involved a device which went off.
However, as the shooting dead of journalist Lyra McKee showed, the intent, the ability to mount attacks, exists.
Overall, the campaign of violence is low-level in historical terms.
MI5, which has the lead role in Northern Ireland counter-terrorism, has hundreds of staff in Holywood working to contain the threat.
‘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.
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.