The phone hacking trial heard how the Duke of Cambridge told his then-girlfriend Kate Middleton about his scare in a voicemail from 2006
The royal revealed his near-miss when he was with the Sandhurst RMA. He wandering into another regiment's ambush in Aldershot according to a message intercepted on his wife's phone by the News of the World, it was claimed.
Transcripts of calls and voicemails between the royal couple were read out to the jury at the Old Bailey today (December 19) by prosecutor Andrew Edis QC.
The transcripts were unearthed during a police investigation.
In the voicemail, the Duke of Cambridge said: "Hi baby. Um, sorry, I've just got back in off my night navigation exercise.
"I had a busy day today again. I've been running around the woods of Aldershot chasing shadows and getting horribly lost, and I walked into some other regiment's ambush, which was slightly embarrassing because I nearly got shot.
"Not by live rounds but by blank rounds, which would have been very embarrassing, though."
In another message played to the court, he called then-girlfriend Kate "babykins" and told he was going "beagling", or hunting with dogs.
The jury was told about eight messages recorded by private investigator Glenn Mulcaire, who pleaded guilty to phone hacking earlier this year.
The court was also shown a News of the World article, by royal reporter Clive Goodman, which detailed the Duke's William's "babykins" nickname for Kate.
The transcripts were read out as part of the prosecution’s evidence against Goodman, 56, who is accused of corrupting a royal protection officer by paying him for copies of the internal Palace phone directories.
Goodman, from Addlestone, Surrey, is charged with former spin doctor Andy Coulson with conspiring to commit misconduct in public office.
Goodman and Coulson, 45, from Charing, Kent, deny two allegations that they conspired together and with other unknown people to commit misconduct in public office between August 31, 2002 and January 31, 2003, and between January 31, 2005 and June 3, 2005.
Coulson is also accused of conspiring to hack phones between October 3, 2000 and August 9, 2006.
That charge is also faced by former NotW and Sun editor Rebekah Brooks, 45, of Churchill, Oxfordshire, Ian Edmondson, 44, of Raynes Park, south west London, and former managing editor Stuart Kuttner, 73, of Woodford Green, Essex.
Both deny the charge.
Brooks also faces two counts of conspiring with others to commit misconduct in public office - one between January 1, 2004 and January 31, 2012, and the other between February 9, 2006 and October 16, 2008 - linked to alleged inappropriate payments to public officials.
She also faces two allegations of conspiracy to pervert the course of justice - one with her former personal assistant Cheryl Carter, 49, of Chelmsford, Essex, between July 6 and 9, 2011, and a second with her husband, Charles Brooks, and former News International head of security Mark Hanna and others between July 15 and July 19, 2011.
Brooks denies all the charges against her.
Ian Edmondson has been discharged from the current trial on health grounds but will stand trial at a later date.
The trial continues.