On May 10, 1997, a passenger climbed into the back of the Belfast taxi. The driver noticed he was carrying a holdall in his right hand. As the taxi turned on to College Avenue, the back windows smashed with a low thud. Glass flew on to the road. Three of the passenger's fingers were strewn around the cab and blood was pouring from his hand. He was screaming as he searched for his fingers. Dripping blood onto the seat, he put each finger he found into his pocket.

The sports bag was in tatters; wires and a large lump of charred yellow cake could be seen in its remains. The driver stared at the bag and then at the passenger, who opened the taxi door with his uninjured left hand. Smoke followed him. A man walking his dog and a woman carrying her shopping stopped and stared. They saw a man limp his way down College Avenue, leaving a trail of blood.

Gerard 'Hucker' Moyna, barely conscious, was put in the back of a car by a dissident republican. Hucker had already served 10 years for possession of weapons and would do life in prison if he was caught in the north. He was driven two hours west and over the border to Donegal.

As with every Saturday, Continuity IRA army council member Joe O'Neill was onstage at his pub in Bundoran, singing rebel ballads with Peggy, a local woman who sang and played the accordion. David Rupert, an American Continuity IRA supporter and financier, remembers O'Neill hurriedly leaving the pub.

"Joe was in the middle of a set," remembers Rupert. "He's told that there is a call for him in the bar. He just gets off the stage, no explanation, and Peggy continues singing."

O'Neill drove his Mercedes from Bundoran a short distance to Ballyshannon, where Hucker was lying in the back of a car, moaning. They drove down the street to a doctor, arriving at close to midnight. "It's an emergency," O'Neill said, knocking on the doctor's door. "The man has no fingers."

The doctor opened up a blood-soaked bandage. Hucker took the fingers from his pocket. O'Neill tried to explain that fireworks had gone off in Hucker's hand. The doctor said that he would have to refer Hucker to Sligo General Hospital.

In Sligo, doctors could see almost immediately that the fingers could not be reattached. Meanwhile, in Belfast, the Army had arrived and sealed off College Avenue.

A robot approached the taxi and leaned its video camera in the back door. It revealed two-and-a-half kilos of Semtex, still unexploded, and a timing device. Only the bomb's detonators had gone off. Had the Semtex exploded, it would have blown up the taxi and everyone standing nearby.

It was clear from the taxi driver's account that the man was badly injured, missing fingers and bleeding from his hand. Sligo General Hospital told the gardai that they believed Hucker had explosives injuries.

Hours later, a group of gardai arrived at the hospital. O'Neill again tried to explain that fireworks had gone off, injuring him, but he was immediately arrested under the Offences Against the State Act and taken to Sligo garda station.

O'Neill posted bail the next morning. He drove straight to the hotel in Bundoran where Rupert was staying. Rupert was making last-minute preparations before going back to his home in the US. O'Neill had an urgent request for him: "I need you to buy the biggest firecrackers you can find, blow them up and them send them to me immediately. Immediately. Now."

If they could get powerful American fireworks couriered overnight, they could scatter them on the beach in Bundoran and concoct a story that Hucker had blown his fingers off while lighting fireworks given to him as a gift by Rupert.

What O'Neill didn't know was that Rupert was an FBI spy working within the Continuity IRA, and everything he told him was being reported back to the FBI field office in Chicago. Agent Ed Buckley cleared it for Rupert to buy firecrackers in a megastore, blow them up and send them to O'Neill for Hucker's alibi.

"You can't get fireworks in Illinois, but across the border in Indiana they were on every street corner," recalls Rupert. "So, I just bought some big ones, let them off across from the trucking office and sent them to Joe."

Before O'Neill could even concoct the story, the gardai knew he was lying. The evidence against Hucker was overwhelming and they were able to show that there was no fireworks residue on the beach. Hucker pleaded guilty and was jailed for seven years.

Rupert made for an unlikely IRA member. Standing six feet seven inches tall and weighing 21 stone, the former wrestler, from Florida, was a trucking company manager in upstate New York, and had no Irish connections.

He did, however, have a very big interest in women, and that is what would eventually bring him to work for the FBI and MI5 while infiltrating the very heart of the Continuity IRA and, later, the Real IRA.

While partying in a beach bar in Florida in 1992, he happened to hear Irish folk music coming from a pub across the road. He was curious and wandered over. There he met a beautiful Irish-American woman named Linda Vaughan.

A major Democratic Party operative, that year she ran the Florida campaign for Connecticut governor Paul Tsongas, who was running for president.

She was also a lobbyist for Noraid, the US fundraising wing of the IRA.

Rupert was besotted with her and feigned some knowledge about Ireland. They were dating from the first night and, within months, she had invited him to Ireland to meet O'Neill and her other republican friends.

After a few visits, the huge American had come to the attention of the Irish Special Branch, who covertly photographed him with O'Neill and with another republican bar owner outside a hotel in Sligo. They passed the photographs to the FBI, who repeatedly called to Rupert's trucking company in Chicago until, eventually, he agreed to FBI-funded trips to Ireland in exchange for small pieces of information about republicans. They even gave him $8,600 to take the lease on a pub outside Bundoran, so he had a better cover for being in Ireland and where he could get deeper into IRA circles.

After the Omagh bomb in 1998, his mission became all the more urgent. By now, the FBI had contacted MI5, who needed someone in the larger - and deadlier - Real IRA.

At the same time, many Continuity IRA members were becoming disillusioned with its narrow, anachronistic and very Catholic outlook. Rupert was good friends with one of them, who drifted over to the Real IRA and told the Real IRA chief, Michael McKevitt, about the wealthy American who was bringing envelopes of $10,000 in cash over to the Continuity IRA several times a year.

McKevitt fell for it - he wanted to poach Rupert for the Real IRA. He, Rupert and the Real IRA's deputy leader, Seamus McGrane, had a meeting at a hotel in Monaghan. Rupert and McKevitt instantly liked each other. In emails to MI5, Rupert can barely contain his excitement. MI5 was also ecstatic.

McKevitt was married to Bobby Sands' sister, Bernadette, who ran the Real IRA's political wing, the 32 County Sovereignty Committee. She, too, warmed to the American, nicknamed 'The Big Yank' by republicans, and soon he was in McKevitt and his wife's house in Blackrock, Co Louth, dropping off envelopes of cash, installing MI5-vetted encryption software on their computer and supplying them with a free computer.

McKevitt liked Rupert so much that he suggested, with the approval of dissident republicans in America, that Rupert sit in on the Real IRA army council to verify that the US money was being well spent - thereby avoiding the "shenangians" of the Provisional IRA, in which millions in US fundraising money ended up in the hands a few select republicans.

In my new book, The Accidental Spy, I draw on 2,300 emails between Rupert and his handlers in the FBI and M15, plus dozens of hours of interviews with Rupert, Real IRA members and security forces, to show just how close to the centre of dissident republicanism he reached.

Army council meetings were held in a cosy cottage overlooking the Cooley Mountains in north Louth, where a farmer's wife made the army council tea while they discussed upcoming attacks in London and Northern Ireland. Rupert was also asked to procure complex bomb parts from America - sometimes from newly developed video games or personal organisers only then available in the US. That took him into the Real IRA engineering department, which met at a house in Dundalk.

At one of the engineering meetings, one of the bomb-makers became suspicious when Rupert handed them encryption software. How could they know it wasn't tampered with? He looked at Rupert suspiciously and then began to raise his voice. Rupert shouted back.

McKevitt intervened and told them both to calm down, that Rupert had come through America and that everything was fine. It was the scariest moment in the operation for Rupert. He wondered how long he could hold on, because there was a growing chorus of suspicion about him.

McKevitt wouldn't listen to it. He needed a US fundraising wing and Rupert had helped him snatch it wholesale from the Continuity IRA. He was their man. He even let Rupert in on his most precious secret: the Provisional IRA's chief funder, the Libyan leader Colonel Gaddafi, wouldn't help the Real IRA, so they were on the international market looking for Saddam Hussein or some other enemy of the UK to step in.

Rupert passed on the information to M15, which immediately got to work. It had Arab agents who could impersonate Iraqi government spies, who soon made contact with McKevitt, offering millions of dollars and tonnes of weapons. They recorded 19 phone calls, in which McKevitt offered to travel to Baghdad to select the weapons to be shipped to Ireland.

In his final phone call, he was angry with the Iraqis that they had not yet sent millions of dollars to an untraceable Irish bank account, as they had promised. The MI5 agents, posing as the Iraqis, pleaded for more time, as there were bureaucratic considerations in Baghdad. McKevitt went to bed angry. The next morning, he was awoken by a thunderous knock on the door. It was the Irish Special Branch.

He was taken to a Garda station, where 700 questions had already been prepared for him. He had been arrested many times before - it was the usual. But he noticed his interviews were dwelling on one subject. "Do you know a David Rupert from the USA?" "Do you know Dave Rupert?" "How long did you know David Rupert?"

It was the first indication for McKevitt that he had been betrayed. He was taken directly to the Special Criminal Court in Dublin and charged with the new, post-Omagh offence of directing terrorism.

Rupert was being kept under very tight security by the FBI, which flew him on the US Attorney General's plane to an RAF base in the UK and then to Ireland to give evidence against McKevitt.

The two men stared at each other across the packed courtroom. George Birmingham, the chief prosecutor, asked the question: "And for the record, can you identify the accused, Michael McKevitt?" Rupert leaned out his arm and pointed his arm at his old friend, who was sitting between two gardai. McKevitt had been warned this moment was coming. He didn't react.

His barristers were waiting. In the longest cross-examination in Irish legal history, they tried to take Rupert apart - his four marriages, his failed businesses, his attempts to set up gambling operations on international waters, his attempts at professional wrestling, even the fact that he once owned a DeLorean car - "built by a crook and driven by a crook", according to McKevitt's chief counsel.

None of it stuck. McKevitt knew the sheer volume of evidence was insurmountable and, after weeks of evidence, very publicly walked out of court and back to his holding cell. The court ruled that Rupert was a "very truthful" witness and jailed McKevitt for 20 years.

Rupert and his wife, Maureen, live under multiple layers of FBI-created identities in the US. In 2008, there was an attempt by a Real IRA leader in Northern Ireland to obtain Rupert's real social security number through an Irish-American sympathiser, but the PSNI alerted the FBI and Rupert bumped up his security - and his weaponry.

In all, he made nearly $10m from his work for the FBI, all because he happened to wander over to an Irish bar and meet a beautiful woman.

"Not in a million years could you recreate the circumstances of what happened," he says now. "It was just one of those things - a small event led to another event to another to another.

"At the time, it didn't seem as scary to me as it does now. I know now that I'm lucky to be alive."

The Accidental Spy by Sean O'Driscoll will be published by Mirror Books, priced £18.99 in hardcover, on January 24

Belfast Telegraph