A soldier thought a military base was "under attack" after hearing gunshots on the night trainee soldier Private Geoff Gray was killed, an inquest heard.
Epi Naiova was a private on guard duty at Deepcut Barracks in Surrey with Pte Gray on the night the 17-year-old suffered two gunshot wounds to his head in September 2001.
He has given evidence at a fresh inquest to the teenager's death.
Cpl Naiova told Woking Coroner's Court today: "I thought we were under attack since we were guarding the officers' mess and, since it's like five days after 9/11, our security status was high.
"I cocked my weapon. I was laying down on my belly buckle facing toward where the sound came from. I was shocked and a bit panicking as well."
Cpl Naiova said he was on guard duty in the early hours of September 17 with Pte Gray and Pte Fay Mulraine when Pte Gray went on a "quick five-minute patrol around the perimeter".
He said: "I was surprised. We were just sitting quietly because it was a quiet night and he just said 'I'm going to do a quick five-minute patrol around the perimeter'.
"I actually said to him 'Geoff, you can't go alone, you need to go with someone' and he said 'no, I'll just do a quick five-minute patrol and I'll come back'.
"On our briefings we were told a patrol has to be two people."
Cpl Naiova then said he heard "a sound like automatic shots fired" around five minutes after Pte Gray had left.
"The shots came from directly from where Geoff was heading," he said.
The family of Pte Gray believe another recruit or recruits may have shot the teenager, who was from Seaham, while he was on guard duty.
In 2002, a coroner recorded an open verdict at the first inquest into the death of Pte Gray.
The new inquest was called because Attorney General Jeremy Wright said he was satisfied fresh evidence had come to light.
Pte Gray was one of four young privates to die at Princess Royal Barracks between 1995 and 2002 amid claims of bullying and abuse.
Sean Benton, 20, Cheryl James, 18, and James Collinson, 17, also died from gunshot wounds.
The inquest, before Peter Rook QC, continues.