The Duke of Sussex has accepted damages and an apology from a news agency which used a helicopter to take photographs of his home in the Cotswolds.
Prince Harry's lawyers told a High Court hearing the pictures taken by Splash News and Picture Agency included one of the inside of a bedroom at the privately-rented Oxfordshire property.
The court heard the pictures had "seriously undermined" Harry's safety.
Splash said it had made an "error of judgement" which would not be repeated.
In a statement, it added: "We apologise to the Duke and Duchess (of Sussex) for the distress we have caused."
Buckingham Palace said the duke "acknowledges and welcomes the formal apology" from Splash.
'High level of privacy'
The court heard the photos, which were "published by the Times newspaper and elsewhere online", were of living and dining areas, and included a shot taken "directly into the bedroom".
The duke's lawyers told Mr Justice Warby that Harry and his wife Meghan had chosen to make the Oxfordshire property their home because of its "high level of privacy".
But Gerrard Tyrrell, who read a statement in court on the duke's behalf, said the couple had subsequently felt unable to live there.
When the photos were published in mid-January, the couple's official residence was Kensington Palace.
But a spokeswoman for the Sussexes said they had spent a lot of time at their country retreat in the Cotswolds, which had been privately rented by Harry.
The duke and duchess moved from Kensington Palace to Frogmore Cottage, Windsor, in April - shortly before Meghan gave birth to their son Archie.
Mr Tyrrell said Splash had agreed to pay a "substantial" sum of damages and legal costs to settle the privacy and data claims faced by the agency.
He added Splash would "not repeat its conduct by using any aerial means to take photographs or film footage of the duke's private home, which would infringe privacy or data rights or otherwise be unlawful activity".
What is Splash?
Splash News and Picture Agency sells news, photos and videos across the world, including paparazzi images of celebrities.
It boasts of taking more than 150,000 photos a day across the globe.
In its code of conduct, Splash says it is "committed to the fair and ethical treatment of our subjects, our contributors and our customers".
But the case brought by Prince Harry is not the first time Splash has been accused of taking intrusive photos.
In 2014, Corbis Images UK Limited - which was trading under Splash's name - made photos of Adele's two-year-old son available for publishing in the English press.
The singer's lawyers accepted a five-figure sum to settle the case.