NEW YORK -- A gay man and his longtime partner decide to become parents using a surrogate mother. Shortly after their son is born, the couple gets married. But there's a catch for this modern family: A will left by the man's wealthy father decrees that he must marry the mother for the child to collect an inheritance.

That quandary has prompted the man, Manhattan Criminal Court Judge Robert M. Mandelbaum, to contest the will in surrogate's court.

Mandelbaum has filed a petition on behalf of his now 2-year-old son, Cooper, that argues that a condition that might "induce the beneficiary to enter into a sham marriage of convenience" should be invalid.

The petition makes two further arguments: that Mandelbaum's partner could be considered the boy's "mother," and that excluding the boy from sharing in the family fortune would run counter to public policies protecting same-sex marriages and their offspring.

The petition portrays the father as being accepting of his son's lifestyle. But the will doesn't make clear why the father appeared to contradict that when it came to his estate.

An attorney for Mandelbaum declined comment on Thursday.

A proposed settlement reached by Mandelbaum and the guardians of two other grandchildren that would give equal stakes in a trust set up by the grandfather is pending court approval, though it could be a longshot.

Joshua S. Rubenstein, a Manhattan lawyer specializing in estate planning, said decedents have a right to shun possible beneficiaries – whether it's because they have two fathers or because they married someone of a different race or any other reason that might sound unreasonable or even cruel.

"We might all find that repugnant, but it's your property and you can do whatever you want with it," Rubenstein said.

Mandelbaum may have "a very strong public policy argument, but the (father's) wishes may be controlling in this case," said Laura E. Stegossi, a Philadelphia estates lawyer.

The 47-year-old Mandelbaum is the son of Frank Mandelbaum, a successful Long Island businessman who died in 2007. The father was chairman and chief executive of Intelli-Check, a Woodbury, N.Y.-based maker of software that verifies the authenticity of driver's licenses and other forms of identification.

The elder Mandelbaum's will set up a trust worth hundreds of thousands for his grandchildren and their decedents. However, the will excluded any "adopted child of Robert, if adopted while Robert is a single person, or a biological child of Robert ... if Robert shall not be married to the child's mother within six months of the child's birth."

According to court documents, Mandelbaum is the biological father of Cooper, who was born in Pomona, Calif., on April, 5, 2010. The boy was conceived by using his sperm to fertilize an egg from an anonymous donor that was then implanted in the uterus of a second woman.

Mandelbaum's petition notes that a California birth certificate lists him as the "Father/Parent" and his partner, a tax lawyer, as the "Mother/Parent." The pair married in Connecticut on July 2, 2010 – within six months of Cooper's birth.

The petition argues that the disputed provision in the will was intended only to "ensure that any children born to Robert were raised in the context of a legally recognized and committed marital relationship."

Mandelbaum's father knew his son was in a committed relationship with another man, and frequently socialized and traveled with them, the papers add.

"Thus if it was the intent of the will were to require that Robert marry a woman, the will would thereby reflect an attempt to induce the breakup of an existing family," they say. "Any will provision reflecting such an intent is likewise unenforceable as against public policy."

Earlier on HuffPost:

Loading Slideshow...
  • Gay Marriage NY

    Supporters of same sex-marriage celebrate after Senate members voted and approved the same-sex marriage bill 33-29 during a session of the New York state Senate at the Capitol in Albany, N.Y., Friday, June 24, 2011. (AP Photo/Hans Pennink)

  • New York State Senate Votes Yes On Gay Marriage Bill After Week Of Delays

    NEW YORK, NY - JUNE 24: Revelers celebrate in front of the historic gay bar The Stonewall after the passing of a bill legalizing gay marriage in New York State on June 24, 2011 in New York City. New York State now joins Connecticut, Massachusetts, New Hampshire, Vermont, Iowa and Washington, D.C. in legally recognizing gay marriage. (Photo by Spencer Platt/Getty Images)

  • Gay Marriage NY

    Tammy Lloyd- Preddice of Middlegrove, N.Y., and Marci Tebbano , right, of Albany, N.Y., celebrate after Senate members voted and approved the same-sex marriage bill 33-29 during a session of the New York state Senate at the Capitol in Albany, N.Y., Friday, June 24, 2011. (AP Photo/Hans Pennink)

  • Joyous Embrace

    Photo by Lauren Thompson

  • Photo by Ashley McAdams

  • Kissing in the street

    Photo by Ashley McAdams

  • New York State Senate Votes Yes On Gay Marriage Bill After Week Of Delays

    NEW YORK, NY - JUNE 24: Revelers celebrate in front of the historic gay bar The Stonewall after the passing of a bill legalizing gay marriage in New York State on June 24, 2011 in New York City. New York State now joins Connecticut, Massachusetts, New Hampshire, Vermont, Iowa and Washington, D.C. in legally recognizing gay marriage. (Photo by Spencer Platt/Getty Images)

  • New York State Senate Votes Yes On Gay Marriage Bill After Week Of Delays

    NEW YORK, NY - JUNE 24: A reveler waves a gay pride flag in front of the historic gay bar The Stonewall after the passing of a bill legalizing gay marriage in New York State on June 24, 2011 in New York City. New York State now joins Connecticut, Massachusetts, New Hampshire, Vermont, Iowa and Washington, D.C. in legally recognizing gay marriage. (Photo by Spencer Platt/Getty Images)

  • Photo by Alana Horowitz

  • Photo by Alana Horowitz

  • Photo by Alana Horowitz

  • Photo by Ashley McAdams

  • Watching the debate

    Photo by Matt Sledge

  • Outside Stonewall Inn

    Photo by Matt Sledge

  • New York State Senate Votes Yes On Gay Marriage Bill After Week Of Delays

    NEW YORK, NY - JUNE 24: A reveler has a celebratory drink in front of the historic gay bar The Stonewall after the passing of a bill legalizing gay marriage in New York State on June 24, 2011 in New York City. New York State now joins Connecticut, Massachusetts, New Hampshire, Vermont, Iowa and Washington, D.C. in legally recognizing gay marriage. (Photo by Spencer Platt/Getty Images)

  • New York State Senate Votes Yes On Gay Marriage Bill After Week Of Delays

    NEW YORK, NY - JUNE 24: Revelers celebrate in front of the historic gay bar The Stonewall after the passing of a bill legalizing gay marriage in New York State on June 24, 2011 in New York City. New York State now joins Connecticut, Massachusetts, New Hampshire, Vermont, Iowa and Washington, D.C. in legally recognizing gay marriage. (Photo by Spencer Platt/Getty Images)

  • New York State Senate Votes Yes On Gay Marriage Bill After Week Of Delays

    NEW YORK, NY - JUNE 24: A reveler waves a gay pride flag in front of the historic gay bar The Stonewall after the passing of a bill legalizing gay marriage in New York State on June 24, 2011 in New York City. New York State now joins Connecticut, Massachusetts, New Hampshire, Vermont, Iowa and Washington, D.C. in legally recognizing gay marriage. (Photo by Spencer Platt/Getty Images)

  • New York State Senate Votes Yes On Gay Marriage Bill After Week Of Delays

    NEW YORK, NY - JUNE 24: Revelers celebrate in front of the historic gay bar The Stonewall after the passing of a bill legalizing gay marriage in New York State on June 24, 2011 in New York City. New York State now joins Connecticut, Massachusetts, New Hampshire, Vermont, Iowa and Washington, D.C. in legally recognizing gay marriage. (Photo by Spencer Platt/Getty Images)

  • New York State Senate Votes Yes On Gay Marriage Bill After Week Of Delays

    NEW YORK, NY - JUNE 24: Revelers celebrate in front of the historic gay bar The Stonewall after the passing of a bill legalizing gay marriage in New York State on June 24, 2011 in New York City. New York State now joins Connecticut, Massachusetts, New Hampshire, Vermont, Iowa and Washington, D.C. in legally recognizing gay marriage. (Photo by Spencer Platt/Getty Images)

  • Gay Marriage NY

    Supporters of same sex-marriage celebrate after Senate members voted and approved the same-sex marriage bill 33-29 during a session of the New York state Senate at the Capitol in Albany, N.Y., Friday, June 24, 2011. (AP Photo/Hans Pennink)

  • Gay Marriage NY

    Revelers celebrate the passage of a bill legalizing same-sex marriage in New York State outside the Stonewall Inn on Christopher St, Friday, June 24, 2011, in New York. The measure passed, 33-29, following weeks of tense delays and debate. (AP Photo/John Minchillo)

  • Gay Marriage NY

    Revelers celebrate the passage of a bill legalizing same-sex marriage in New York State outside the Stonewall Inn on Christopher St, Friday, June 24, 2011, in New York. The measure passed, 33-29, following weeks of tense delays and debate. (AP Photo/John Minchillo)

  • Gay Marriage NY

    Revelers celebrate the passage of a bill legalizing same-sex marriage in New York State outside the Stonewall Inn on Christopher St, Friday, June 24, 2011, in New York. The measure passed, 33-29, following weeks of tense delays and debate. (AP Photo/John Minchillo)

  • Gay Marriage NY

    Revelers celebrate the passage of a bill legalizing same-sex marriage in New York State outside the Stonewall Inn on Christopher St, Friday, June 24, 2011, in New York. The measure passed, 33-29, following weeks of tense delays and debate. (AP Photo/John Minchillo)

  • Gay Marriage NY

    Sen. Thomas Duane, D-Manhattan, left, and New York Gov. Andrew Cuomo talk in the Senate Chamber at the Capitol in Albany, N.Y., after gay marriage was legalized after a vote, on Friday, June 24, 2011. (AP Photo/Mike Groll)

  • Gay Marriage NY

    New York Gov. Andrew Cuomo reacts after same sex marriage was legalized after a vote in the Senate Chamber at the Capitol in Albany, N.Y., on Friday, June 24, 2011. (AP Photo/Mike Groll)

  • Gay Marriage NY

    Supporters of same sex marriage celebrate after Senate members voted and approved same-sex marriage at the Capitol in Albany, N.Y., Friday, June 24, 2011. New York lawmakers narrowly voted to legalize same-sex marriage Friday, handing activists a breakthrough victory in the state where the gay rights movement was born. New York will become the sixth state where gay couples can wed and the biggest by far.(AP Photo/Hans Pennink)

  • Photo by Ashley McAdams

  • Photo by Ashley McAdams

  • APTOPIX Gay Marriage NY

    Revelers celebrate in front of the Stonewall Inn in Manhattan's west village following the passing of the same sex marriage bill by a vote of 33 to 29, Friday, June 24, 2011, in New York. Same-sex marriage is now legal in New York after Gov. Andrew Cuomo signed a bill that was narrowly passed by state lawmakers Friday, handing activists a breakthrough victory in the state where the gay rights movement was born. The gay rights movement is considered to have started with the Stonewall riots in New York City's Greenwich Village in 1969. (AP Photo/Louis Lanzano)

  • Photo by Sophie Robbins