All National Guards are now processing military benefits for same-sex couples after several holdout states found ways to implement the policy without violating their constitutional bans on recognizing gay marriage.

Defense Secretary Chuck Hagel said in an announcement Friday that same-sex spouses in every state can now obtain the military ID cards they need to receive benefits provided to wives and husbands of service members.

“All of DoD is committed to pursuing equal opportunities for all who serve this nation, and I will continue to work to ensure our men and women in uniform as well as their families have full and equal access to the benefits they deserve,” Hagel said.

A handful of states, including Texas, Louisiana, Mississippi and Georgia, refused to process ID applications for gay spouses after the Pentagon issued a directive requiring the military to treat all legally married couples equally for purposes of federal benefits. The states told same-sex couples to apply at federal installations instead.

Hagel directed the chief of the National Guard Bureau in late October to work with state officials to reach full compliance with the Defense Department’s new policy, which came in response to a landmark Supreme Court decision in June overturning a key provision in the Defense of Marriage Act.

Slowly, the holdout states and the National Guard Bureau found workarounds to ensure equal treatment of service members without allowing their employees to process same-sex benefits.

South Carolina required all National Guard spouses to apply at federal installations regardless of their sexual orientation, eliminating the possibility of unequal treatment at state facilities. And in Texas, the bureau agreed to switch some service members to federal status so they could process the benefits without violating state law.

Other states with gay-marriage prohibitions complied with the Defense Department policy right away, saying they could process ID applications for gay spouses without violating their constitutions. Those states included Alabama, Kentucky, Michigan, North Carolina and Virginia.

The American Military Partners Association, a gay-rights advocate, commended the Pentagon in a statement Friday for following through with its policy. But the group said same-sex couples still face other forms of “discrimination and exclusion by state governments,” particularly those that don’t recognize gay marriage.

Follow Josh Hicks on TwitterFacebook or Google+. Connect by e-mail at  josh.hicks@washpost.comVisit The Federal Eye, The Fed Page and Post Politics for more federal news. E-mail with news tips and other suggestions.