Prince Harry was unharmed after an attack on the Camp Bastion military compound in Afghanistan in which two US Marines were killed and several more wounded.
Harry, an Army captain, is based at the compound in Helmand province in the south of Afghanistan for his second tour of duty.
US officials said the attack last night was by heavily-armed insurgents and involved a range of weaponry, including mortars, rockets or rocket-propelled grenades, as well as small arms fire.
Harry was about two kilometres away with other crew members of the Apache attack helicopters, of which he is a co-pilot gunner, when the attack took place, sources said.
There are no indications of any British fatalities or injuries.
A spokesman for the International Security Assistance Force coalition (Isaf) in Afghanistan said the attack occurred near an airfield on the north-east side of the base, which houses American forces in Camp Leatherneck.
A number of aircraft, hangars and other buildings at the base were hit and badly damaged by insurgent fire.
An Isaf spokesman in Afghanistan said: "I can confirm there was an attack involving small arms fire."
The official added: "The attack is long over and now UK and US forces are in the process of conducting an assessment to discover the extent of the damage and go through the camp to make sure everything is secure."
A Ministry of Defence spokesman in London said: "We are aware of an incident that has taken place at Camp Bastion, which is currently being dealt with."
Price Harry, who celebrates his 28th birthday today, arrived in Afghanistan last Friday.
He has been undergoing training to fly operations in Apache attack helicopters and is expected to start flying missions this week as a co-pilot gunner.
Camp Bastion is a huge base in the middle of the desert and is shared with US, Estonian, Danish and Afghan troops.
It is the logistics hub for operations in Helmand, with supply convoys and armoured patrols regularly leaving its heavily-defended gates, to support the military forward operating bases, patrol bases and checkpoints spread across the province.
Major Martyn Crighton, a spokesman for Isaf, said there was no threat that it was a major attack on Camp Bastion by a large group of insurgents.
He said: "Nobody would deny that the insurgents are opportunistic.
"Isaf's facilities are very safe places, it just so happens that last night insurgents were able to make a spectacle of themselves and cause some damage.
"But there wasn't any real threat that it was under attack from a large group of insurgents."
Maj Crighton described the attack as "complex", in that insurgents used AK47-type weapons as well as mortars or rockets.
It is understood the militants managed to breach Camp Bastion's perimeter using rocket-propelled grenades before being driven back by forces inside the camp.
But he said there was no evidence to suggest whether the attack had been planned in advance or if it was simply opportunistic.
He added there was no indication that the attack had anything specifically to do with a series of protests and violence across the Muslim world this week that were sparked by an anti-Islamic film.