A gay Manhattan man is fighting his father's will, which specifies that he must marry a woman for his children to get his money.

Frank Mandelbaum, who died in 2007, instructed in his will that his son Robert Mandelbaum must be married to the mother of his children within six months of their birth, otherwise the children get none of his money.

Robert, a Manhattan Criminal Court Judge, argues that he married his husband Jonathan O'Donnell shortly after their 16-month-old son Cooper's birth via a surrogate, entitling the child to a portion of his father's estate. He stated that O'Donnell is the only “mother” Cooper knows, the New York Post reported.

At stake is a portion of the $180,000 trust Frank Mandelbaum left his three grandchildren.

Robert Mandelbaum turned to Manhattan Surrogate Court to settle the dispute, claiming the demand is discriminatory and violates New York law.

The will “imposes a general restraint on marriage by compelling Robert Mandelbaum … to enter into a sham marriage,” he said in court papers.

“There is no doubt that what [Frank Mandelbaum] has sought to do is induce Robert to marry a woman,” Anne Bederka, a law guardian appointed to represent Cooper, wrote in court papers.

Robert Mandelbaum said his father was aware that he is gay and knew his longtime partner.