The officer who was on duty with Detective Garda Adrian Donohoe when he was shot dead during an armed robbery in Co Louth seven years ago has said he thought the raiders had fired a warning shot.
Detective Garda Joe Ryan told the jury at the Central Criminal Court that he was "completely terrified" and "in fear for his life".
He said two of the raiders pointed their weapons at him and threatened to kill him while demanding keys and money.
He was giving evidence in the trial of Aaron Brady, from New Road, Crossmaglen in Co Armagh.
Mr Brady has pleaded not guilty to the murder of Det Garda Donohoe and to a second charge of robbing €7,000 in cash and cheques on 25 January 2013 at the Lordship Credit Union.
Det Garda Ryan was on escort duty with Det Garda Donohoe for the delivery of cash from four Carlingford Peninsula credit unions on the night of Friday 25 January 2013.
He told the jury that he saw two men running to his right, heard a loud bang and saw a flash but thought it was a warning shot.
"I didn't anticipate anyone being shot," he said.
The car door opened, the court heard, and two men pointed a shotgun and a handgun at Det Garda Ryan.
He was he said "inches from the muzzle of the shotgun", which was moved up and down his body.
He said three things were shouted at him a number of times.
"Give us the keys", "Give us the money", and "I'm gonna f***ing kill you".
The detective said he was "in fear for his life", "completely terrified" and that his preference would have been to have been shot with the handgun because he would have had a better chance of survival.
The jury also heard details of two calls that the detective made immediately after the raiders fled and he found his colleague fatally injured.
Det Garda Ryan called for urgent assistance on his radio and said: "Adrian is I think fatally shot."
A 999 call to gardaí in Drogheda was also played in court, where the detective said: "We had a robbery, one man shot, he's dead at this stage, shot in the face, all I saw was two men."
The trial continues tomorrow.