Harriet Wran has been subjected to a “sustained and unpleasant campaign” by the Daily Telegraph and the Sunday Telegraph causing her “immense psychological distress” and humiliation, Justice Ian Harrison said in handing down her sentence.

Wran was handed a four-year prison term for robbery in company and a one-year jail term for acting as an accessory after the fact to the murder of the Redfern drug dealer Daniel McNulty.

Harrison gave her a two-year non-parole period for the robbery offence, meaning that, with time already served, Wran will be eligible for release on 12 August.

Harrison used his sentencing remarks to criticise the coverage of the case in the Sydney tabloids, citing headlines in the Daily Telegraph such as “DIRTY HARRIET” and “Revealed: Wran’s role in ice junkies’ plot to murder a drug dealer”. Harrison said the headlines incorrectly implied that Wran had willingly taken part in a planned murder and made her a potential target in a dangerous environment.

The “ill-informed” reporting of the News Corp Australia’s Sydney newspapers was so damaging to Wran, who was forced into protective custody for 12 months, it was a mitigating factor in sentencing the daughter of the former Labor premier Neville Wran.

“In my opinion the publication of these egregious articles warrants the imposition of a sentence that takes account of Ms Wran’s continuing exposure to the risk of custodial retribution, the unavoidable spectre of enduring damage to her reputation and an impeded recovery from her ongoing mental health and drug-related problems,” he said.

In his remarks Harrison said Wran had been placed in maximum security for her own safety rather than for behavioural or disciplinary reasons.

“She has been the target of threats and unpleasant attention from other prisoners,” he said. “Ms Wran was placed in a harsh custodial environment because of her unwanted and unsolicited public profile.

“Apart from the uncontrollable accident of her birth, Ms Wran has done nothing to place herself in the public eye.

“Ms Wran’s privacy, and that of her family, has also been grossly invaded. Family photos have been republished. Ms Wran’s private correspondence has been extracted for prurient consumption. Even her distraught telephone calls to her mother have been transcribed and, in an extraordinary step, re-enacted for listeners to consume online.

“The articles make allegations about her criminality, sexual conduct and reputation that have no basis in fact but from which she has no ability to defend herself.”

Harrison said the “extra-curial punishment” Wran had been subjected to included the implication that she had received special treatment because of her family connections and the publication of private correspondence and family photographs. Misleading headlines such as “Plea to escape murder trial: Harriet’s secret bid to cut a deal” and “Nev’s daughter seeks get-out-of-jail deal in drug murder case” gave the unfair impression she had been treated differently to other people on trial.

One article, “How I Ended Up in Hell”, included lengthy extracts from letters and included details of her daily prison life, her interactions with other inmates and her observations about warders. “Its publication exposed Ms Wran to unwelcome attention from inmates and some prison staff,” Harrison said.

The allegation in “Sex, drug binge after murder” that Wran had loud sex after the murder “has not been advanced by the crown and has been vehemently denied by Ms Wran”, he said.

Harrison also singled out the Sydney Morning Herald and the Daily Mail for picking up the stories and republishing them. “Ms Wran is not able to anticipate when or if this gratuitous campaign will end.”

In a second judgment on Tuesday, Harrison dismissed an application by News Corp Australia for access to Wran’s personal references and the names of people who had supplied them.

Harrison denied the request, citing an earlier case in 2007 when the Telegraph published the names of 59 referees who provided references to a former crown prosecutor who was facing sentence upon charges of possessing child pornography under the headline “Pervert’s legal pals”.

“Secondly, I have no confidence, based upon the newspaper’s past performance, that it will not proceed to treat Mr Wran’s referees in the same unpleasant and misleading fashion in which it has already treated her,” he said. “One could be excused for forming the view that the Daily Telegraph has some form of vendetta against Ms Wran. There is no reason to assume that, if the opportunity arose, her referees might not also soon become victims of the very same campaign.”

In its editorial column on Wednesday, the Daily Telegraph replied: “With the greatest of respect, we would submit that neither the Daily Telegraph nor the Sunday Telegraph has ever been involved in anything as sustained and unpleasant as the murder that left Daniel McNulty dead.

“Judge Harrison accused both papers of running ‘distasteful and wholly misleading headlines’ about Wran during her period of imprisonment. On the latter charge we stand by our reporting and the presentation of our reporting. On the former charge, we do not believe it is the court’s role to consider questions of media taste. That is the public’s role, and they deliver verdicts every day through newspaper sales and website views.”

The editorial went on: “The primary reason Wran was ‘exposed to unwelcome attention from inmates and some prison staff’ was that she had been jailed while awaiting trial over a person’s murder. Any subsequent issues with her imprisonment must be considered relatively trifling compared to that overwhelming central fact.”