Prince Harry (Matt Cardy/Getty)

A gay former soldier has opened up about how Prince Harry protected him from homophobic abuse in the army.

James Wharton told Forces News that Prince Harry was his tank commander in 2008 when he experienced a homophobic incident with fellow soldiers.

“I’d got myself into a bit of a situation with some soldiers from another regiment and, essentially, they didn’t’ like the fact that I was gay,” Wharton said.

“They were sort-of chest poking me and making me feel quite uncomfortable.

“I got into my tank where Prince Harry was doing something, and he could see that I was clearly affected by something and he asked me what the problem was.”

Wharton continued: “I told him that there were a couple of soldiers outside who weren’t very happy with the fact that I was gay.”

Prince Harry was ‘quite offended’ that gay soldier was being targeted because of his sexuality.

He revealed that the Duke of Sussex was “quite offended” that he was being picked on.

“Prince Harry went out and saw these soldiers and spoke to them, and the problem went away,” he said.

“He told them off and they left me alone.”

Elsewhere in the interview, Wharton praised Prince Harry as a “good” officer who was “well-liked”.

This is not the first time Wharton has opened up about Prince Harry’s support while they served in the armed forces together. In 2013, his book Out in the Army delved into his experiences as a gay man in the British Army.

Prince Harry went out and saw these soldiers and spoke to them, and the problem went away.

At the time, Wharton wrote that a group of soldiers from another regiment threatened to “batter” him.

“I told him [Prince Harry], ‘I think I’m going to be murdered by the infantry.’ I climbed into the turret and talked Harry through exactly what had happened. He had a complete look of bewilderment on his face.

“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.’”

Soldier will ‘always be grateful’ to the Duke of Sussex.

He continued that Harry approached the group without hesitating, and that upon his return he said the situation was “sorted”.

“I will always be grateful to Harry,” Wharton continued. “I will never forget what happened. Until he went over and dealt with everything I was on track for a battering.”

Wharton became the first openly gay man to appear on the cover of Soldier magazine in 2009.

The gay former soldier came under fire in 2014 when he wrote an article for Winq magazine arguing that gay saunas were “thorns in our side that mark our community as different for the wrong reasons”. He later backtracked on his views.

Meanwhile, Prince Harry has made headlines this week after he and his wife Meghan Markle announced that they will be stepping down as senior members of the Royal family.

The couple announced that they will be splitting their time between the UK and the US going forward.