Jennifer Pizer, right and her partner Doreena Wong cut a wedding cake during a street celebration of California Supreme Court ruling that gay couples in the nation's biggest state can marry. (May 15, 2008) (Hector Mata/ASSOCIATED PRESS)

The law firm hired to mount the legal defense of the federal government’s ban on recognizing same-sex marriage has withdrawn from the case, the firm announced Monday, after it was sharply criticized by gay rights groups.

The decision by King and Spalding has led Paul D. Clement, the partner who had been selected as the lead attorney on the case, to resign. On Monday, Clement — a solicitor general under President George W. Bush — said he will continue to defend the constitutionality of the Defense of Marriage Act as a partner at another firm.

In a resignation letter released to the media, Clement said he felt compelled to resign — not because of his views on the legislation, which he did not disclose, but “out of the firmly held belief that a representation should not be abandoned because the client’s legal position is extremely unpopular in certain quarters.”

He continued: “Much has been said about being on the right side of history. But being on the right or wrong side of history on the merits is a question for the clients. When it comes to the lawyers, the surest way to be on the wrong side of history is to abandon a client in the face of hostile criticism.”

It is the latest dust-up in the legal fight over the Defense of Marriage Act, a 1996 law that forbids the federal government from extending spousal benefits to same-sex couples, even if they are legally wed in their states. About a dozen lawsuits challenging the legislation have been filed nationwide.

House Republicans had hired Clement after the Justice Department, which customarily defends U.S. laws against legal challenges, took the unusual step in February of announcing that it would no longer do so with the Defense of Marriage Act. In a reversal, Attorney General Eric H. Holder Jr. said the Obama administration had determined that the law was unconstitutional.

The duty of upholding the legislation then fell to Congress. House Republicans disclosed last week that they had selected Clement — a highly respected lawyer who was coveted by prominent firms when he entered private practice in 2008 — and his firm to represent their interests.

The firm immediately came under assault from gay rights groups, including the Human Rights Campaign, which began contacting the firm’s clients and urging students at top law schools to push the firm to drop the case.

Groups noted that King and Spalding devotes a page on its Web site to its advocacy on gay issues and its efforts to hire gay, lesbian, bisexual and transgender lawyers and staff members. And they predicted that the firm would be judged harshly by future generations if it sided with House leaders in a fight that they consider a struggle for civil rights.

King and Spalding employs more than 800 lawyers and represents a range of large clients, including Coca-Cola, Google and Wal-Mart. Clement announced Monday that he has joined Bancroft, a smaller “boutique” firm where he will work with other administration lawyers. Among them is Viet D. Dinh, the founder of the firm, who served as Bush’s assistant attorney general for legal policy and helped write the USA Patriot Act.

Robert D. Hays Jr., chairman of King and Spalding, issued a short statement to reporters Monday saying that his firm had erred in accepting the case but he did not detail the reason. “In reviewing this assignment further, I determined that the process used for vetting this engagement was inadequate,” Hays said, adding that the mistake was his.

The decision drew an immediate rebuke from House leaders.

“The Speaker is disappointed in the firm’s decision and its careless disregard for its responsibilities to the House in this constitutional matter,” Brendan Buck, a spokesman for House Speaker John A. Boehner (R-Ohio), said in a statement. “At the same time, Mr. Clement has demonstrated legal integrity, and we are grateful for his decision to continue representing the House. This move will ensure the constitutionality of this law is appropriately determined by the courts, rather than by the President unilaterally.”

Clement has defenders among some who support same-sex marriage. Theodore B. Olson — Clement’s predecessor as Bush’s solicitor general, now better known for his work seeking to invalidate California’s voter-approved ban on same-sex marriage — said Clement “acted in this situation at the highest levels of professionalism and consistent with the highest standards of the legal profession.”