In a ruling on Wednesday, Mr Justice Warby said he had concluded that “for the time being at least” Meghan should be granted an order which protects the identities of the individuals.
Following the ruling, a source said the duchess was “happy” with the decision.
The Duchess is suing Associated Newspapers (ANL), the publisher of the Mail On Sunday and MailOnline, over an article which reproduced parts of a “private and confidential” handwritten letter she sent to her estranged father Thomas Markle (76) in August 2018.
At a preliminary hearing in London last week, Meghan’s lawyers applied for the five friends who gave an interview to People magazine to remain anonymous in reports of the proceedings.
ANL opposed the application.
In his ruling, Mr Justice Warby said he was granting the duchess’s application, but added that the decision could change in the future.
He said: “I have concluded that for the time being at least the court should grant the claimant the orders she seeks, the effect of which will be to confer protection on the sources’ identities.
“That is confidential information, the protection of which at this stage is necessary in the interests of the administration of justice.
“This is an interim decision.”
The senior judge went on to say that Meghan’s case has been ongoing for 10 months and is still “some way” from trial.
“The weight to be given to the relevant factors may well change as the case progresses,” he said.
“Those that require that confidentiality should prevail over transparency at this preliminary, case-management stage, may fade or even evaporate if and when there is a trial at which one or more of the sources gives evidence.”
Giving the reasons for his ruling, Mr Justice Warby said: “At this stage, continued anonymity not only upholds the agreement made between People magazine and the five friends, and the reasonable expectations which that generated; it also supports the proper administration of justice by shielding the friends from the ‘glare of publicity’ in the pre-trial stage.
“Generally, it does not help the interests of justice if those involved in litigation are subjected to, or surrounded by, a frenzy of publicity.
“At trial, that is a price that may have to be paid in the interests of transparency.
“But it not a necessary concomitant of the pre-trial phase.
The duchess felt it was necessary to take this step to try and protect her friends - as any of us would - and we're glad this was clear.
“It is reasonable to be concerned that in that phase the peculiarly febrile atmosphere surrounding this case, and some of the coverage, could act as a deterrent and undermine fairness and due process.”
Following the ruling, a source said the duchess had the interests of her friends at heart.
The source said: “The duchess felt it was necessary to take this step to try and protect her friends – as any of us would – and we’re glad this was clear.
“We are happy that the judge has agreed to protect these five individuals.”
In the People article, published in February last year, the friends spoke out against the bullying Meghan said she has faced.
They have only been identified in confidential court documents.
The duchess (39) says her friends gave the interview without her knowledge, and denies a claim made by ANL that she “caused or permitted” the People article to be published.
At a hearing last week, Meghan’s lawyers argued that the friends – referred to as A to E – have a right to anonymity both as confidential journalistic sources and under their own privacy rights.
In written submissions, Antony White QC, acting for ANL, said the friends are “important potential witnesses on a key issue”.
“Reporting these matters without referring to names would be a heavy curtailment of the media’s and the defendant’s entitlement to report this case and the public’s right to know about it,” he said.
ANL won the first skirmish in the legal action on May 1, when Mr Justice Warby struck out parts of Meghan’s claim, including allegations that the publisher acted “dishonestly” by leaving out certain passages of the letter.
Meghan is suing ANL over five articles in total – two in the MoS and three on MailOnline – which were published in February 2019 and reproduced parts of a handwritten letter she sent to her father in August 2018.
The headline on the article read: “Revealed: The letter showing true tragedy of Meghan’s rift with a father she says has ‘broken her heart into a million pieces’.”
The duchess is seeking damages from ANL for alleged misuse of private information, copyright infringement and breach of the Data Protection Act.
ANL wholly denies the allegations, particularly the duchess’s claim that the letter was edited in any way that changed its meaning, and says it will hotly contest the case.