Elaine Joyce, a champion amateur golfer, made a federal case of being barred from playing in a 2007 men’s tournament at Dennis Pines Golf Course, where she is a longtime member. She sued the town of Dennis, Mass., and others in 2008. Last week, the United States District Court in Boston, in a rare federal ruling involving a town, its public golf course and an accusation centering on sex discrimination, told her she had won.

Judge Nathaniel M. Gorton ruled that a municipality and its public golf course were liable under federal equal-protection laws if they engaged in sex discrimination through policy, conduct or custom.

“It has been kind of a lonely road as far as support from other people, men or women,” Joyce, 45, said in a telephone interview. “For me, this decision means encouragement that I was right, and it certainly upheld what I took the law to mean. Hopefully, that prevents other women from having to go through this.”

Gorton said that his decision did not require all public courses to conduct only coed tournaments. He stated that when a town’s golf officials “draw a clear distinction based upon gender and their only explanation is to deny that any distinction existed, they will not prevail.” He said the burden was with the club’s officials “to justify their conduct, and they have not done so.”