A bomb discovered in a parked vehicle in Londonderry was to be used to attack a police patrol, detectives said.
The device was operated using a command wire.
Officers said it was an improvised explosive belonging to the dissident republican New IRA grouping.
Assistant chief constable Mark Hamilton said: "The bomb would have killed or maimed anyone near it when it detonated."
Police were attacked with missiles by members of a crowd of 60-100 people as they carried out searches targeting dissidents.
Around 40 petrol bombs were thrown during Monday evening's disorder.
Officers found the viable explosive device while looking for New IRA bomb-making equipment in the Creggan Heights area of the city.
The Police Service of Northern Ireland (PSNI) later said 15 families who were evacuated could return to their dwellings.
At least two young people engaged in the disorder in Derry's Creggan estate sustained burn injuries during the violence, the PSNI said.
Mr Hamilton said: "By bringing a viable bomb into the community they have again proved that have no regard for the lives of anyone living in Creggan.
"Once again they exploited some of the young people in the community to attack police and have brought disruption and misery to families."
The police searches were launched after a dissident republican mortar bomb was recovered in Strabane, Co Tyrone, on Saturday.
The mortar, which was positioned close to a family home, was aimed at the town's police station.
It was the seventh attempted murder bid against the security forces in Northern Ireland this year.
Journalist Lyra McKee, 29, was murdered by the New IRA in the same Creggan Heights area in April as she observed dissident rioting.
Mr Hamilton described the operation as "complex" as he condemned those indulging in disorder.
"The focus of this operation is ensuring the people of Creggan are safe. However, it is concerning to see significant numbers of young people on the streets, late into the night, throwing petrol bombs and other missiles at officers in the area," he said late on Monday night.
"The reality is this type of disorder contributes to the complexity of the policing operation and presents a real risk of injury to those involved."