Now, Mr. Obama is in a tough spot. If he supports the personnel office on denying benefits to the San Francisco court employees, he risks agitating liberal groups that helped him win election. If he supports the judges and challenges the marriage act, he risks alienating Republicans with whom he is seeking to work on economic, health care and numerous other matters.

Already, some gay rights groups remain upset over Mr. Obama’s choice of the Rev. Rick Warren, an opponent of same-sex marriage, to give the invocation at his inauguration. Liberal groups also believe that Mr. Obama has not moved fast enough to reverse the policies of his predecessor on issues like detention and interrogation of terrorism suspects.

In a letter on Feb. 20 to the Administrative Office of the United States Courts, an arm of the federal judiciary, Lorraine E. Dettman, assistant director of the personnel office, said, “Plans in the Federal Employees Health Benefits Program may not provide coverage for domestic partners, or legally married partners of the same sex, even though recognized by state law.”

Benefits are available to the spouse of a federal employee, Ms. Dettman said, but the 1996 law stipulates that “the word ‘spouse’ refers only to a person of the opposite sex who is a husband or a wife.”

Federal officials said they had to follow the laws on the books. But Richard Socarides, a New York lawyer who was an adviser to President Bill Clinton on gay issues, said he believed that Mr. Obama “has broad discretionary authority to find ways to ameliorate some of the more blatant examples of discrimination.”