After two tell-all books, tawdry sex claims and 3 1/2 years of living apart, New Jersey's gay former governor and his estranged wife are finally facing off in divorce court starting Tuesday.

Jim McGreevey stepped down in his first term in 2004 during a nationally televised speech in which he acknowledged being "a gay American" and having an affair with a male staffer while married to Matos McGreevey.

He and his wife, who have been married for four years, have been going at each other publicly for months in a series of pretrial motions.

The first three days of the trial, however, will be conducted away from the glare of television cameras and reporters under order of the presiding judge.

Union County Superior Court Judge Karen Cassidy decided to hear custody issues relating to the couple's 6-year-old daughter first, and she sealed documents and testimony regarding the child.

Besides custody, the issues in the divorce settlement involve alimony and child support, and whether McGreevey, now openly gay, committed fraud by marrying a woman.

Matos McGreevey, 41, seeks $600,000 as compensation for the time she would have lived at the governor's mansion in Princeton, New Jersey, had her husband not resigned in disgrace.

Since his resignation, both he and his soon-to-be-ex wrote books about their time together, including their sex lives. She claims she never knew he was gay until just before he told the rest of the world. He claims their marriage was "a contrivance on both our parts," but that he fulfilled the marriage contract by providing companionship and a child.

The most sensational witness could be Teddy Pedersen, a 29-year-old former aide who claims he had regular three-way sexual encounters with the McGreeveys beginning when they were dating in 1999 and ending two years later, after they were married and McGreevey had been elected governor.

John Post, a lawyer representing Matos McGreevey, is seeking to bar Pedersen's testimony. Matos McGreevey says the encounters never happened. McGreevey says they did.

McGreevey, 50, now lives with a male partner and is studying to become an Episcopal priest.