Andrew Ruck from Edinburgh was a mountain leader on an adventure holiday to Svalbard, in the remote Norwegian archipelago, with the British Schools Exploring Society in August 2011 when the tragedy occurred.
Horatio Chapple, 17, from Salisbury, was sleeping in his tent when the bear went on the rampage, inflicting fatal injuries to his head and upper body.
Four others, including Mr Ruck, were injured before the bear was shot dead at the camp site.
Moments earlier, the polar bear had attacked trip leader Michael Reid, known as Spike, who tried to fight it off with a rifle.
Mr Reid yesterday told how when the bear turned on him, he tried to gouge out the animal’s eyes because he thought that was an area of weakness.
Describing the scene to an inquest in Salisbury, Wiltshire, Mr Ruck said: “I woke up straight away and sat bolt upright. I then remember Spike or I opening the tent to see the polar bear there. I do not think it had anyone or anything in its mouth at that stage.”
He said that he then saw Mr Reid attempting to fire the rifle at the bear.
“He tried to fire the rifle four times, bullets emptied out, he shouted, ‘It’s not working’ and then the bear came over to him and knocked him to the floor.
“After that, I exited the tent through the other entrance. I just charged towards the bear, shouted and picked up rocks and threw them at its face.
“I remember the bear then attacked me and knocked me straight to the floor. Its paws were on my shoulder, I remember seeing its face.
“It swiped my face with its claw and my head would have ended up in its mouth at some point.
“The bear left me for some reason but I had very few clear thoughts after that.
“I know I ended up not in the spot where it attacked me and ended up right next to Horatio. I must have been aware someone had been very badly injured and I think I was trying to help.”
Mr Ruck said that a decision had been made to use a tripwire system as an early-warning alert that night, adding that a bear watch would have had its own risks if it had been used instead.
He said: “Bear watches themselves carry considerable risk – they are absolutely not a fool-proof system, they are open to human error.
“Essentially, no system is 100 per cent guaranteed to be reliable and it was essentially weighing up the risk of having people standing outside in the cold.”
He added: “Most encounters with polar bears are not fatal or even problematic. I am certainly aware that the behaviour of our bear charging into the campsite is completely abnormal.”
Earlier, Mr Reid, from Plymouth, Devon, told the inquest how he had wrestled with the predator when it attacked him after his rifle failed to fire.
He said he had been awoken by several people shouting “bear attack” before he grabbed the group’s rifle and left his tent.
He tried to fire the rifle at the bear which was on top of one of the team members but it failed to shoot a number of times.
Describing how the bear then turned on him, Mr Reid said: “The bear came and attacked me because the rifle was then on the ground beside me.
“I shouted, ‘Use your pen rounds’ [flares] even though I hadn’t briefed the others where they were stored overnight, and although they are not safe to use (in close quarters) they are better than this bear carrying on.
“I remember the bear biting my head and I thought the weakest part is the eyes so I tried to take out the eyes with my fingers, but was unsuccessful.”
Mr Reid described Horatio, a pupil at Eton, as a fantastic member of the team.
“One of the best, if not the best on the expedition. A fine young gentleman with amazing potential,” he said.
The inquest continues.