The parental struggle over Hilary Foretich, the District 8-year-old who spawned lawsuits, court orders, prison sentences, federal legislation, television documentaries and an international search, has come to at least a temporary close in a New Zealand court.

Declaring that Hilary's "physical, educational, spiritual and emotional needs are being met," Family Court Judge P.D. Mahoney said she could remain with her mother, plastic surgeon Elizabeth Morgan, with whom she has been living in the New Zealand city of Christchurch since March.

Mahoney made no finding on the tantalizing question that has enveloped the five-year-old case: whether Hilary was sexually abused by her father, Eric A. Foretich, an allegation he has denied and no court has upheld.

Nonetheless, Mahoney barred Foretich from visiting his daughter in New Zealand "in the immediate future," arguing that visits would again place Hilary in the eye of parental conflict "with the inevitable disruption of her emotional security."

Instead, Foretich, a Virginia oral surgeon, will receive a photograph of Hilary every six months, as well as reports on her health and school work, and eventually will be allowed to mail her gifts and cards.

Although Mahoney said that Hilary believes Foretich and his parents sexually abused her, he added that Morgan and Morgan's parents have so often told the child about such abuse that for Hilary "that is the reality, whether or not her belief has any basis in fact."

"In my view, it is now part of the family ethos that she is an abused child, and it would be impossible for her not to identify with the convictions of her mother and maternal grandparents," Mahoney wrote, according to WUSA-TV (Channel 9), which obtained details of the ruling.

Mahoney added that a court-appointed psychiatrist, Karen Selas, believed Hilary was an "over-valued child" who wielded too much influence within her family.

The 31-page ruling, issued Nov. 21, has not been released in New Zealand, which has strict laws about publicity in child-custody cases. But Channel 9 said a source had allowed reporter Joan Gartlan to take extensive notes from a copy of the decision.

What began as a local custody fight blossomed into national drama in 1987, when Morgan sent her daughter into hiding rather than allow Foretich to continue to visit Hilary. She was born after the couple was divorced in 1982 and became the subject of a legal battle that intensified in 1985, when Morgan alleged that Foretich had begun abusing Hilary when the child was 2 years old.

Ordered by D.C. Superior Court Judge Herbert Dixon to disclose Hilary's whereabouts, Morgan refused and was imprisoned, winning her freedom 25 months later when a sympathetic Congress passed legislation designed specifically for her.

Foretich, meanwhile, scoured the world, finally finding Hilary in New Zealand, where she had been living with Morgan's parents after a brief stay in Great Britain. The struggle then moved to the New Zealand courts, with Foretich seeking to bring Hilary back to the United States.

In awarding custody, Mahoney listed several conditions that ensure his court will retain a major role in Hilary's case. According to Gartlan, Hilary cannot change residences within New Zealand or leave the country without permission of the court, which will retain custody of her passport.

She must remain a pupil at Selwyn House School until further court action, and a book about the case being written by Elizabeth Morgan cannot be published in New Zealand.

In an interview last night, Foretich implied that the struggle was over, for now.

"I think it's a done deal," he said. "My daughter's a loser, and I'm a loser. I've followed all the court orders, played it straight down the line, and in the bottom analysis, I've lost everything except my dignity and pride."

In an earlier statement, Foretich said it was not "appropriate for Hilary to be the focal point of further contention."

"I made the decision that I would unilaterally withdraw once I was able to locate Hilary and determine that she was at least physically well," he said. "As for myself, I wish to be left alone so that I can care for my patients in the manner in which I was trained to do. I will always love my daughter and will be there for her when she needs me."

Foretich said he did not contest the case before Mahoney because he did not want to win custody rights that applied only in New Zealand. "I don't live in New Zealand," he said. "I'm an American."

Instead, he had hoped initially that he would be allowed to bring Hilary to the United States, he said, but that hope faded because it seemed likely the New Zealand courts would take into account how long Hilary already had lived in the country. The best he could achieve, he said, would be some conditions on her life in New Zealand.

Morgan could not be reached for comment. Her New Zealand attorney, A.J. Forbes, said in a telephone interview that neither he nor his client would discuss the case because "we have told the judge we'll give no publicity to the outcome of the proceedings, and we'll abide by that."

James Morgan, Elizabeth Morgan's brother, said in a telephone interview from New York that he did not believe the case had reached its conclusion, because Foretich is "endless in his litigation."

Moreover, James Morgan said, if his sister and Hilary ever returned to the United States, they probably still would be subject to an order that Dixon issued giving Foretich visitation rights here. And both mother and child would like to return home, he said.

"New Zealand is a beautiful country, and in a way a little slice of heaven on Earth, but she's an American," James Morgan said of his sister.

He added that because she is now married to federal Judge Paul Michel, "she'd love to come back here and be with Paul, of course. They have the ultimate long-distance marriage."

Michel, who is in New Zealand, could not be reached for comment. But James Morgan said Michel has no plans to move there because "he was just appointed to the federal bench, and has a great career here."

Foretich said he did not know what action he would take if Elizabeth Morgan and Hilary returned to the United States. But he noted that Dixon's court order was "still outstanding . . . . That's not going to change."

In his ruling, Mahoney said the dispute between Foretich and Morgan was so acrimonious that even if Foretich were cleared of the allegations, "little" would change. The judge suggested that Morgan in particular has become preoccupied with the case.

"What is most needed is for Dr. Morgan to relax her determination that Dr. Foretich should not have a meaningful part to play in Hilary's life," he said, according to Channel 9. "When that happens, progress can be made."

Mahoney also said that if Hilary were sent to the United States, she again would become the object of enormous media scrutiny.

"It is inevitable she would become a victim of it all and suffer probably serious detriment as well," he said.