Justice Elena Kagan praised and defended a former Bush administration official’s decision to leave his law firm rather than abandon what has become a controversial agreement to defend the federal ban on recognition of same-sex marriages.

At a crowded reception at Georgetown University Law Center on Thursday for lawyers who practice before the Supreme Court, Kagan recognized former solicitor general Paul D. Clement for his “integrity, professionalism and honor.”

Kagan said it was not a surprise that Clement would resign from his law firm “rather than abandoning a client.” Those who criticize Clement “misunderstand the traditions and ethics of the legal profession,” she said.

Clement’s client is the House of Representatives, which hired him and the Atlanta-based law firm King & Spalding because of challenges to the Defense of Marriage Act. The firm came under pressure from gay rights groups for agreeing to defend the 1996 law, which 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 law have been filed, but Attorney General Eric H. Holder Jr. said in February that the Obama administration did not consider the law constitutional and would not continue to defend it. The House’s Republican leadership then hired Clement.

Clement resigned when his firm said it wanted to back out of the case. He will continue to represent the House as a partner at a different firm, Bancroft PLLC.

King & Spalding, which 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, has said only that it did not properly consider the contract before accepting it.

Robert D. Hays Jr., chairman of King & Spalding, issued a short statement to reporters Monday and took the blame for “inadequate” vetting of the assignment.

But Clement alluded to the controversy in his resignation letter.

“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,” he wrote. “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.”

The events have led to a spirited discussion in the legal community about how firms should select their clients and a lawyer’s responsibility after accepting a controversial case.

Gay rights groups say they are justified in their efforts to persuade the firm to drop its representation, comparing the same-sex marriage issue to civil rights struggles.

Many in in the legal community — including Holder and now Kagan — have sprung to Clement’s defense.

Holder said that Clement was “doing that which lawyers do when we are at our best” and that criticism of the former solicitor general was “misplaced.”

Kagan, appointed by President Obama and in her first term as a justice, did not mention the specifics of the case when making the remarks about Clement.

The event at which Kagan spoke — Georgetown’s Supreme Court Institute reception honoring Acting Solicitor General Neal Katyal — was closed to news coverage. But through a court spokeswoman, Kagan confirmed recollections of her remarks and agreed they could be used in a news story.