Prince Harry is an officer and a gentleman! The 28-year-old royal reportedly made quite a lasting impression on one of the soldiers under his command back in 2008 after Harry defended him against a homophobic attack.

Lance Corporal James Wharton reveals in his new memoir, Out in the Army, that the young prince was quick to deal with the bullies after they reportedly threatened Wharton's life.

PHOTOS: Prince Harry's tour of Afghanistan

Wharton, who served under Harry during a four-month training period in Canada, describes how he "stupidly" bragged about how he had "scored the night before" with another officer to several other members of the infantry, leading six soldiers to approach him angrily that afternoon, asking why he was "spreading rumors about our Martin." 

"This was turning into a bit of a situation," Wharton writes. "Under huge pressure I went back to my vehicle to find Prince Harry. …I told him: 'I think I'm about to be murdered by the infantry.'"

PHOTOS: Harry's hottest moments

"I climbed into the turret and talked Harry through exactly what had happened," he continues. "He had a complete look of bewilderment on his face. I didn't hold back: I told him everything that had gone on. I couldn't stop the tears from welling up in my eyes. He said: 'Right, I'm going to sort this s--t out once and for all.'"

Wharton then details how Harry immediately hopped out of the tank to confront the other soldiers angrily.

"I worried he was about to make the whole thing worse, but he wasn't holding back," Wharton explains. "Prince Harry was sticking up for me and putting a stop to the trouble. I had been on track for a battering and had been rescued."

PHOTOS: Best of 2011: The year of royals

Harry and Wharton remained close throughout the rest of the training, and even after Wharton left the army in early 2013, he says he looks back upon their time in the military together fondly, due in large part to Harry's "kindness."

"I'll never forget the four weeks we worked together and the incredible conversations we shared," he writes. "The experience lives on as the stand-out period of my decade in the military."

This article originally appeared on Prince Harry Defended Gay Soldier From Homophobic Attack: Report