(CNN) -- Videos purportedly shot by Britain's Prince Harry and including offensive language prompted an official apology Saturday from the prince and the royal family.
Prince Harry apologized when video surfaced of him making offensive comments while on military duty in 2006.
According to the British-based News of the World, which released the videos on its Web site, the videos show British soldiers while a voice presumed to be Harry's calls one solider a "Paki," and in another clip tells soldier wearing a cloth on his head that he looks "like a raghead."
A spokesman for Prince Harry apologized in a statement released by St. James's Palace Saturday after the videos surfaced online. The spokesman said the prince -- who is third in line to the British throne -- "understands how offensive this term can be, and is extremely sorry for any offense his words might cause."
It is not first apology for offensive behavior by Prince Harry. In 2005, he was photographed wearing a Nazi uniform to a party, for which he said he was sorry.
"It was a very stupid thing to do and I've learned my lesson, simple as that really," he said in a September 2005 interview marking his 21st birthday. "I'd like to put it in the past now. What's done is done. I regret it."
The videos, filmed during his military service in 2006, were shot by the prince, according to the Web site.
In one video, a voice from behind the camera says "Ah, our little Paki Friend...Ahmed," as the camera zooms in on a soldier from across the room. The video does not show Prince Harry's face, but News of the World suggests that the voice is his.
The soldiers were waiting for their flight to Cyprus for a mission, according to the Web site.
The royal family said the 'paki' term was a nickname for a friend in his platoon.
"There is no question that Prince Harry was in any way seeking to insult his friend," the St. James's Palace statement said.
The second video was filmed after arriving in Cyprus, according to News of the World, and shows a British soldier with a cloth over his head.
A voice, which the News of the World claims to be Harry's, is heard saying, "(expletive) me, you look like a raghead."
In response to that comment, St. James's Palace said, "Prince Harry used the term 'raghead' to mean Taliban or Iraqi insurgent."
Dickie Arbiter, a former press secretary to Queen Elizabeth II, Prince Harry's grandmother, urged people to take the prince's words in context.
"Harry is not the same man as he was three years ago," Arbiter told Britain's ITN network. "You don't think when you are shooting a video."
And he pointed out that Harry was serving in the army, where language is not always delicate.
"It is quite common for names to be used in the military.... He's a serviceman first and foremost, but people see him as a prince first and he has to be careful of what he says."
The British Ministry of Defense said it was not aware of any complaints against Prince Harry and would investigate the allegations of inappropriate behavior, according to a written statement released Saturday.
"Bullying and racism are not endemic in the Armed Forces," it said.
CNN's Katy Byron contributed to this report.
All About Prince Harry of Wales