A pipe bomb was found on a crowded bus on its way to Dublin just hours before the Queen was due to arrive in the capital today.
Thirty passengers hurriedly left the coach when it was stopped and searched 40 miles from the city.
The explosive device was discovered in a holdall in the luggage compartment when it was checked in Maynooth, Co Kildare late last night.
The bus had been on its way from Ballina, Co Mayo.
The device was found 12 hours before the Queen and the Duke of Edinburgh were due to touch down at Baldonnel, west Dublin, heightening fears of some sort of attack by dissident republicans to disrupt the historic visit.
Army bomb experts carried out a controlled explosion during a three-hour operation.
The bus – operated by the state-owned Bus Eireann company – had been stopped outside an hotel, apparently after a tip-off.
The passengers were told to get off and move well clear.
With up to 8,000 police officers on full alert, a security source said: “This device was viable. It had the potential to detonate and do harm.”
It is understood that 100 plain-clothed officers from London’s Metropolitan Police are also involved in the biggest security operation ever mounted in the Republic of Ireland.
Politicians on both side of the Irish Sea have described the four-day visit event as momentous.
British Prime Minister David Cameron said: “I believe Her Majesty’s visit will be the start of something big.”
When the Queen, joined by the Duke of Edinburgh, arrives in Dublin she will become the first British monarch to travel to the Republic in 100 years.
An unprecedented security operation, costing an estimated €30m, is in place to safeguard the royal couple, which includes land, air and sea patrols and a ring of steel around the centre of the Irish capital.
Some opposition to the royal visit has been voiced, which comes against a background of increasing dissident republican violence.
But both governments say they hope the official trip will hasten a new and better relationship between the people of Ireland and Britain, built on equality and mutual respect.
Mr Cameron will join the Queen tomorrow for part of her trip, highlighting the importance of the visit, and Foreign Secretary William Hague will accompany the royals throughout their stay, as part of normal practice.
Irish president Mary McAleese, interviewed by state broadcaster RTE for a documentary to be screened tonight, said: “I think it is an extraordinary moment in Irish history. A phenomenal sign and signal of the success of the peace process and absolutely the right moment for us to welcome onto Irish soil, Her Majesty the Queen, the head of state of our immediate next-door neighbours, the people with whom we are forging a new future, a future very, very different from the past, on very different terms from the past and I think that visit will send the message that we are, both jurisdictions, determined to make the future a much, much better place.”
Taoiseach Enda Kenny has said the Queen will receive a “warm welcome” from the people of Ireland and that the public would have opportunities to meet her.
More than 6,000 garda officers and Defence Forces troops are being deployed on the streets of Dublin while surveillance has been stepped up on known republican dissidents.
Security chiefs are also preparing for any “protest stunts” – particularly at sensitive points during the four-day tour, including the Garden of Remembrance, which honours all who fought for Irish freedom, and Croke Park, the scene of massacre by British troops in 1920.
A ring of steel, involving 25 miles of crowd-control barriers, has been thrown up around the capital, which will keep most of the general public at a distance from the monarch as well as suspected republican activists.
Anyone trying to pass through perimeters faces being searched although the Gardaí said they would facilitate some protest.
Dublin’s O’Connell Street, will be shut down along with Phoenix Park, where the royal visitors will be staying in Farmleigh. the former home of the Guinness brewing dynasty.
Rolling closures will also hit several other main arterial routes throughout Dublin as the Queen is transported to other engagements at Government Buildings, the war memorial at Islandbridge, Trinity College, the National Stud in Kildare and the Convention Centre.
Parking has also been banned on 30 city centre streets.
The Queen’s grandfather George V was the last reigning monarch to visit the Republic in 1911 when it was still part of Britain.
The bitterness caused by the partition of the island a decade later and the use of the British Army in the North strained relations between the UK and the Republic of Ireland for much of the 20th century.
But the success of the peace process has greatly eased tensions and a visit by the monarch is seen by many as cementing a closer relationship.
Sinn Féin president Gerry Adams stressed his party was still against the royal visit and would host celebrations of republicanism in each city the Queen visits. He described the visit as premature and insensitive.
Anti-war campaigners and left-wing republican group Eirigi, which has one council seat, are planning a series of protests.
The start of the visit falls on the anniversary of atrocities which claimed the greatest loss of life in a single day of the Troubles. Thirty-four men, women and children, including an unborn baby, were killed in no-warning explosions in Dublin and Monaghan on May 17, 1974.
The victims’ families and survivors of a series of bombs have written an open letter to the Queen to mark her arrival in Ireland and will hold their annual wreath-laying ceremony a few hundred yards from where the Queen will commemorate Irish rebels in the Garden of Remembrance.
Justice For The Forgotten has appealed to the monarch to urge Prime Minister Cameron to open secret files which were withheld by the British Government during an inquiry.