U.S. Attorney General Eric Holder speaks on camera about the Supreme Court's ruling on Tuesday that struck down part of the 1965 Voting Rights Act designed to protect minority voters, at the Justice Department in Washington, June 25, 2013. (Jonathan Ernst/Reuters)

One of the Supreme Court’s historic decisions on same-sex marriage marked not only a victory for gay rights advocates but a coda to a long and sometimes contentious debate in the Justice Department about how to handle the law that denies federal benefits to gay men and lesbians.

Two years ago, in an unusual move, Attorney General Eric H. Holder Jr. decided the department would no longer back the 1996 Defense of Marriage Act, which defines marriage as a union between a man and a woman and denies marriage-based federal benefits to same-sex married couples.

In doing so, Holder overruled key department lawyers who argued that the department should continue to defend DOMA on constitutional grounds. Those officials included the acting solicitor general at the time, Neal Katyal, according to current and former administration officials. Acting Associate Attorney General Tony West, then head of the civil division, agreed with Holder, while some of his career lawyers supported the legal arguments put forth by Katyal.

“The Department of Justice was totally split on this,” said one senior Justice official, who like others spoke on the condition of anonymity to discuss internal deliberations candidly.

Another senior Justice official said: “It was a very complicated issue. And there was a diversity of views about how best to proceed.”

Officials close to Holder said he felt vindicated by the court decisions Wednesday, especially in light of the “opposition in his building.” Katyal, who is now in private practice, declined to comment.

The victory for Holder comes during a week when his department has suffered two serious defeats. On Tuesday, a divided Supreme Court invalidated a critical component of the landmark Voting Rights Act of 1965, a decision that Holder called “a serious setback for voting rights and has the potential to negatively affect millions of Americans across the country.”

A few days before, Holder and his Justice Department were unable to persuade Hong Kong to arrest confessed National Security Agency leaker Edward Snowden and extradite him back to the United States.

But the Supreme Court’s rulings on same-sex marriage were a clear victory for Holder, who called them “an enormous triumph for equal protection under the law for all Americans” and vowed to “work expeditiously . . . to implement the court’s decision.”

A group of conservative House Republicans has blasted the decisions as legally inconsistent and detrimental to the future of the nation’s children. Rep. Tim Huelskamp (Kan.) pledged to soon file a constitutional amendment to reinstate DOMA.

The Justice Department has a long-standing tradition of defending statutes passed by Congress despite the political stances of the president. That tradition formed the basis of the argument made by Katyal and several career attorneys. But in February 2011, with at least three challenges to DOMA working their way through the federal courts, the Justice Department said it would no longer oppose challenges to the law.

In a Feb. 23, 2011, letter to House Speaker John A. Boehner (R-Ohio), Holder said that he and President Obama had determined after an extensive review that the law’s key section was unconstitutional and “violated the equal protection component of the Fifth Amendment.”

“Thirty years from now, when people have forgotten about all the day-to-day controversies, this decision on DOMA will be the thing that people will remember about Eric Holder,” said Matthew Miller, Holder’s former spokesman. “It was a courageous political decision, but one that was completely grounded in the law.”