Armed PSNI men have seized four mortar bombs just minutes before dissident republicans planned to blitz Derry's main police station.
They rammed a Citroen Berlingo van, which had been heading for the Strand Road HQ a mile away with four primed home-made missiles ready to be launched through a roof which had been cut open.
Police chiefs admitted the terrorists came dangerously close to inflicting massive casualties.
Taoiseach Enda Kenny said the minority of people who want to draw Ireland back to the Troubles will not achieve their ambition.
"I'm glad that these dissidents were apprehended and that these mortars taken out of commission," Mr Kenny said, attending a British-Irish Parliamentary Assembly in Letterkenny, Co Donegal.
"I want to assure everybody that as far as the Government is concerned, the Government will work very closely with the Assembly and the British Government, and that relations between the PSNI and gardaí remain at the very highest level."
Chief Superintendent Stephen Cargin said: "There is no doubt about their intention. They were intent to kill and cause maximum police fatalities."
Three men, all known to police in Derry - this year's UK City of Culture - were arrested.
One had been driving the van. A second had been following behind on a motorcycle and the third was detained two hours later in the city's Creggan estate. Two are aged 37, the third 35.
Officers had mounted a major surveillance operation and tailed the Dublin-registered van on the Letterkenny Road before moving in to intercept it in the Brandywell district on Sunday night.
More than 100 homes had to be evacuated and families moved out while army explosives experts examined the mortars.
The devices had been recently constructed and were similar in design to the type of bombs manufactured and used with such devastating effect by the Provisional IRA before they called a halt to their terrorist campaign in July 2005.
Nine officers were killed when a police station in Newry, Co Down, was hit in a missile attack in February 1985.
Mr Cargin, the district commander in Derry, said many civilians could also have died had the attack not been foiled - not just in flats and houses in close to the station at Strand Road, but as the bombs were being transported through heavily built-up urban areas.
Mr Cargin said: "This was a risky, risky operation.
"Those mortars could have gone off at any time, and even if they (the terrorists) had reached the intended target there was no guarantee they would have hit it, because these mortars are so unreliable.
"Can you imagine what the outcome would have been had they landed nearby, on a gas tank or a petrol tank? It does not bear thinking about."
Dissident republicans blasted the Strand Road police station with a 400lb car bomb in August 2011.
No one was hurt and even though there have been several attacks on property in the city centre since then, this is their principal target in Derry.
Just 48 hours earlier, more than 5,500 men, women and children had gathered on the opposite side of the River Foyle to smash the record for the biggest song-and-dance routine by performing a number from the hit musical 'Annie'.
Republicans suspected of supporting or being involved in acts of violence are under constant police surveillance in Derry amid fears the dissidents are intent on disrupting the UK City of Culture programme.
It seemed apparent that security chiefs had good intelligence in advance of this latest security operation.
Northern Ireland Secretary Teresa Villiers said: "It is a grim reminder of how severe the terrorist threat remains in Northern Ireland."
Condemnation for foiled bid
Politicians on all sides, including Martin McGuinness, the Northern Ireland deputy First Minister and a former IRA commander in Derry, condemned the dissidents.
He said it was quite clear the PSNI had managed to foil many of the recent attempts by a small number of people to bring death and destruction onto the streets, and that it was through good work they were not talking about a disastrous situation in Derry.
Mr McGuinness said: "If the people involved in these actions believe that they can by attempting to carry out armed actions undermine the political process, then they are greatly mistaken.
"Whatever differences may exist between the parties in Stormont we are all absolutely united in our efforts to stand up against violent attempts to undermine the political progress already made, be they from loyalist flag protesters or those involved in incidents like last night.
"There is no going back to the past. The community in Derry City and elsewhere simply will not allow it.
"The groups still wedded to pointless armed actions need to reflect on that political reality, because if they continue on their current path all that will be achieved is more people in prison.
"This is not about any attempt to advance a united Ireland. This is a vanity trip by those involved, and more about money and ego than patriotism."
SDLP MP for Foyle Mark Durkan said: "These mortar bombs are not precision devices - and God only knows where any one of those four devices could have gone or the damage it could have done.
"We have all been spared an awful catastrophe - not only in physical terms to buildings or our infrastructure, but also in human terms."
East Derry MP Gregory Campbell claimed: "We were 10 minutes away from a disaster. That is how close we were to a really bad night in Londonderry. The mortars were ready to be fired. There could have been dozens of people killed."