An undercover British army soldier has claimed he bugged a hospital and planted listening devices in the homes of senior Sinn Féin politicians years after the IRA ceasefire in 1994.

The former intelligence soldier told the Guardian that many of the tiny cameras and minute bugs he secreted all over Northern Ireland were still in place years after he left a secret military unit.

Senior Sinn Féin members, the including former IRA hunger striker Raymond McCartney, were still being targeted in secret surveillance operations until the 2000s, he said.

“We put a bug into Raymond McCartney’s house because we were not sure which way the republican movement was going in the early part of the 21st century.”

Seán Hartnett (not his real name), who has just published a book about his part in the secret counterterrorism war, said republicans were “still gathering intelligence on the security forces in the early 2000s despite being on ceasefire, so we did the same on them”.

“The bug I know was planted in Raymond McCartney’s house was so sophisticated I would be hugely surprised if it has ever been found.”

Hartnett revealed that British military intelligence in the early 2000s hid tiny cameras and bugs in various places, including one inside Altnagelvin hospital in Derry, as part of its secret war against the Real IRA. He said many were probably still in place.

Hartnett’s memoir focuses on the seven years he served in the Joint Communications Unit Northern Ireland (JCUNI), formerly the controversial Force Research Unit, also known as the Det.

He alleges that one of the undercover units he was working for was prepared to carry out a shoot-to-kill operation against a Real IRA cell outside an army base in Omagh just four years after the terrorist group’s bomb attack that killed 29 people in the County Tyrone town.

The 40-year-old former military spy-technician, who was born in Cork in the Irish Republic, said he would not return to the UK because he feared he could be arrested and prosecuted for breaching the Official Secrets Act.

In an interview in Ireland, Hartnett said he was certain the advanced spying equipment his units used to monitor Real IRA and Ulster loyalists was now being used to watch Islamic State terror suspects in the UK.

Although, he added, the devices he used while tracking Real IRA suspects and gathering “political intelligence” on Sinn Féin were now even more advanced.

“The technical advances they had made would lead even someone like me to struggle to pick out say a hidden camera in a parked vehicle these days,” Hartnett said.

He said that, just like in Northern Ireland, many of the cameras and listening devices hidden in homes, businesses, vehicles and other places in the rest of the UK would remain in place long after surveillance operations were wound down. “Northern Ireland is awash with bugs and secret cameras because, after all, we never went about taking them out when our operations were ended. The same will be true of any spying equipment that is planted in English cities and towns.”

Asked where the strangest place was that he had planted a listening device, Hartnett replied: “Definitely in Altnagelvin hospital in Derry. It was 2002 and after the Omagh bomb atrocity of 1998 the Real IRA had a resurgence. They were bombing again in Britain in the early 2000s; the rocket attack on MI5’s headquarters and the bomb at the BBC come to mind.

“There was one suspect/patient from Derry in the hospital who was being visited by another Real IRA operative and we wanted to know what they were taking about on these visits. So I was sent in personally to place the listening device where they were having their chats. To be honest it’s probably still there.”

He repeated the allegation, made in his book Charlie One, that military intelligence was prepared to kill two Real IRA men on their way to kill British soldiers at an ATM in Omagh in 2002.

“The Real IRA cell had the ATM at a garage under surveillance because soldiers from the nearby St Lucia army barracks in Omagh were using it to draw out cash. We had the team under surveillance and thanks to one our listening devices we had hard intelligence the Real IRA were going to use a motorbike to carry out a drive-by shooting as squaddies left the base to take out money at the ATM.

“I was told the plan was to surround the garage with undercover soldiers and open fire as the motorbike team turned up and the pillion passenger drew his gun. But at the last minute, the attempted hit on the soldiers didn’t take place because the Real IRA team couldn’t get their motorbike started. If the machine had started up these two men would be dead today.

“My colleagues told me they were determined to take them out as one of them had been responsible for the murder of a police officer during the Troubles. Those Real IRA pair do not realise how lucky there were.”

Hartnett said his book originated while he was undergoing therapy for post-traumatic stress disorder after being discharged from the undercover army regiment in 2005.

“My counsellor told me to write down all my experiences of the secret war and having amassed so many stories of my time in the Det I realised there was a book in this.

“I don’t know if the British authorities will prosecute me for telling my story but I am not taking any chances and won’t be back in the UK again. But out of therapy came this book and it’s my story which I had to tell.”