New Jersey Supreme Court Chief Justice Robert N. Wilentz has delivered a decision worthy of Solomon in the Baby M surrogate motherhood case. The 95-page ruling provides a framework for resolving the emotionally charged case in the best interests of the child without brutally destroying the child's mother, as the lower court had done.

The 7-to-0 opinion gave custody of Melissa Stern, who is now 22 months old, to her biological father, William Stern, and his wife, Elizabeth, with whom the child has lived since she was 4 months old. The court found that, taking everything into consideration, the Sterns could provide a more stable home life for a little girl who will desperately need it.

That was the only point on which the Supreme Court upheld Superior Court Judge Harvey Sorkow. Most significantly, the Supreme Court ruled that commercial surrogate contracts were nothing more than thinly disguised baby-selling schemes -- "designed to circumvent our statutes." It found that Sorkow was wrong when he awarded temporary custody to the Sterns after Mary Beth Whitehead-Gould changed her mind about giving up her baby and again last March, when he ruled that surrogate contracts were valid and awarded permanent custody to the Sterns.

Sorkow terminated Whitehead-Gould's parental rights on the spot and allowed Elizabeth Stern to adopt the child within hours of his ruling. The Supreme Court ruled that he was wrong there, too, and threw out the adoption.

This means that Whitehead-Gould, who has since remarried, is entitled to visit her daughter. The court ordered that the issue of visitation be decided by another judge who should bear in mind that Whitehead-Gould is "not only the natural mother, but also the legal mother, and is not to be penalized one iota because of the surrogacy contract. Mrs. Whitehead, as the mother . . . is entitled to have her own interest in visitation considered."

The ruling is not binding on other states but it does establish principles of decency and the public interest that any judicial or legislative body would do well to incorporate in evaluating these arrangements. It reaffirms the sanctions against baby-selling, the paramount importance of parental rights and the very narrow rules under which they can be terminated. The ruling reaffirms the state's overriding interest in regulating adoptions and requiring that they be done through approved agencies. Third parties -- such as lawyers fixing up surrogate schemes for profit -- won't do, nor will their in-house counseling services, which the court found protected no one involved, least of all the child.

For the first time since Whitehead-Gould began her legal struggle, she found a court that put more value on motherhood and the relationship between a mother and her baby than on a piece of paper. "It seems to us that given her predicament, Mrs. Whitehead was rather harshly judged -- both by the trial court and by some of the experts," Wilentz wrote. "She was guilty of a breach of contract, and indeed she did break a very important promise, but we think it is expecting something well beyond normal human capabilities to suggest that this mother should have parted with her newly born infant without a struggle. Other than survival, what stronger force is there? We do not know of, and cannot conceive of, any other case where a perfectly fit mother was expected to surrender her newly born infant, perhaps forever, and was then told she was a bad mother because she did not."

The court ruled that in custody questions involving newborns "only in the most unusual case should the child be taken from its mother before the dispute is finally determined by the courts on its merits. The probable bond between mother and child, and the child's need, not just the mother's, to strengthen that bond, along with the likelihood, in most cases, of a significantly lesser, if any, bond with the father -- all counsel against temporary custody in the father."

The court concluded with the hope that the Sterns and Whitehead-Gould can work out visitation themselves, in "the best interests of the child." It has given all of the parents involved a chance to do this, by recognizing the legitimacy of all of their rights and by granting the full force of the law's protection to all of the parties involved.

And by outlawing commercial surrogacy it took motherhood out of the marketplace, where it was subject to the totally inappropriate laws of commerce. "There are," Wilentz wrote, "values that society deems more important than granting to wealth whatever it can buy, be it labor, love, or life."

The Sterns and Whitehead-Gould will not appeal the court ruling -- a sign of what a very wise man Chief Justice Wilentz must be.