Princess Diana leaked a royal phone directory to the now defunct News of the World tabloid, its former royal editor has told Britain's phone-hacking trial.
Clive Goodman said Diana sent him the contacts book by post in 1992, the year she separated from Prince Charles.
"She was going through a very, very difficult time," Goodman told London's Old Bailey court, where he is on trial for paying public officials for royal directories.
"She told me she wanted me to see the scale of her husband's staff and household, compared with others. She felt she was being swamped by people close to his household. She was looking for an ally to take him on, to show there were forces that would rage against him."
Goodman, 56, is accused of two counts of conspiring to commit misconduct in a public office while working at Rupert Murdoch's News of the World, which he denies.
Goodman was previously jailed in 2007 for hacking into the phones of members of the royal household, along with private investigator Glenn Mulcaire.
Goodman told the court he used so-called green books and internal phone directories containing contact numbers for staff and senior members of the royal household as a basis for his stories. Under questioning by his defence lawyer in his first day in the witness stand, Goodman denied paying for them and said one green book was given to him in 1992 by Diana. "That arrived at my office in Wapping with my name on it," he said.
Diana, the mother of princes William and Harry, was killed in a car crash in Paris in 1997.
Asked how he used the information in the royal directories, Goodman described one story he wrote about the flying of the flag at Buckingham Palace after Diana's death.
"People [members of the public] wanted the flag at half-mast but the palace got caught up in stuffy protocol because the queen wasn't there," and refused to raise it, he told the court.
"Then a flag shot up a pole for about 20 minutes and then came down again. The palace said it was a mistake but we had a tip-off that it was a palace fireman who was so enraged."
Goodman said he used the contacts book to track down the fireman, who confirmed the story off the record.