Revelers outside the u.s. Supreme Court in Washington on June 26, 2015 after its historic decision on gay marriage. AFP PHOTO/ MLADEN ANTONOVMLADEN ANTONOV/AFP/Getty Images

Days after the Supreme Court ruled that the right to marry must be open to gays, the Department of Veterans Affairs has moved immediately to extend marital benefits to same-sex couples who were denied them — even in states where they were available to other federal retirees.

The new policy lifts restrictions on veterans’ pensions, VA-backed home loans, burial rights, survivor benefits and disability compensation for same-sex married couples in every state, a victory that advocates estimate could affect hundreds of thousands of veterans.

[Supreme Court rules gay couples nationwide have a right to marry]

“We are thrilled that they are acting so quickly,” said Chris Rowsee, director of family readiness for the American Military Partners Association, which sued VA last year on behalf of veterans who were denied spousal benefits. The lawsuit was on hold pending the Supreme Court decision.

Other veterans groups praised the new policy as a historic shift in a community whose older members were resistant just four years ago to lifting the military’s long-standing ban on gay, lesbian, bisexual and transgender troops serving openly.

The Supreme Court ruled, 5 to 4, that same-sex marriage bans are unconstitutional. Here's what you need to know. (Gillian Brockell/The Washington Post)

“For our generation of veterans, marriage equality is definitely a core issue,” said Paul Rieckhoff, founder and chief executive of Iraq and Afghanistan Veterans of America, which supported the repeal of the “don’t ask, don’t tell” policy.

“Many of our members are openly gay themselves, or were kicked out under don’t ask don’t tell,” he said.

[Federal employees’ same-sex spouses already get benefits]

Because of a longstanding federal law that applied only to veterans, thousands of gay and lesbian veterans were shut out of dozens of benefits the federal government extended to same-sex spouses starting in 2013. That’s when the court, in an earlier decision, invalidated language in the Defense of Marriage Act that had defined a marriage — for federal benefits purposes — as only between a man and a woman.

A similar law had restricted Social Security benefits for same-sex couples.

As long as they were married in one of the 37 states that recognized same-sex marriage, even if the state they lived in didn’t, federal employees and retirees got health insurance, survivor benefits rights and other employment-related rights after the court’s 2013 decision.

But veterans didn’t have access to these benefits, despite their federal service and the painful irony that the Defense Department had made the same benefits available to all military spouses regardless of their sexual orientation. That’s because the provision of the federal code that sets out benefits for veterans — Title 38, Section 103 C of the Code of Federal Regulations — recognized the validity of a marriage only in the state where the veteran lives.

So veterans in same-sex marriages in 13 states — Arkansas, Georgia, Kentucky, Louisiana, Michigan, Mississippi, Missouri, North Dakota, Ohio, South Dakota, Tennessee, Texas and Nebraska — were still denied benefits.

“VA may recognize the same-sex marriage of all Veterans, where the Veteran or the Veteran’s spouse resided anywhere in the United States or its territories at the time of the marriage or at the time of application for benefits,” VA spokeswoman Victoria Dillon said in a statement describing the new policy.

The agency “will work quickly to ensure that all offices and employees are provided guidance on implementing this important decision with respect to all programs, statutes, and regulations administered by VA. ”

She said the agency is coming up with guidance on how to implement the changes; pending benefit-claims cases involving same-sex marriage will be placed on temporary hold until the guidance is in place.

Until this guidance has been issued, VA will temporarily wait to adjudicate all claims regarding same-sex marriage that cannot be immediately granted based on prior guidance.

The policy also lifts restrictions on dependency claims for compensation and pension, survivors pensions, dependency and indemnity compensation, accrued benefits, home loan guaranties, education (GI bill), burials and health care, officials said.

“VA leadership is taking the next step on their own and recognizing the tea leaves,” said Phillip Carter,  who studies veterans’ issues for the Center for a New American Security.

“VA, at the end of day, is involved in very sensitive family issues, whether it’s burials, disability benefits compensation, health care for the dying,” he said. “These are things that matter so much in veterans’  lives.”

A spokeswoman for the Social Security Administration, LaVenia J. LaVelle, said in a statement that the agency is “working with the Department of Justice to analyze the decision and provide instructions specific to the decision for Americans who rely on our programs and services.”

“We will keep you posted as we update our policy.”