SALT LAKE CITY — The last of the Utah counties that were holding out on issuing marriage licenses to same-sex couples reversed course Thursday and decided to hand out licenses to all eligible applicants.

Officials for the four holdouts – Box Elder, Utah, Piute and San Juan counties – told The Associated Press they had little choice after an appeals court Tuesday declined to intervene and halt gay marriage.

U.S. District Judge Robert Shelby ruled last week that Utah’s ban on gay marriage was unconstitutional, sending gay couples rushing to clerk offices for licenses.

The state plans to take its fight against gay marriage to the U.S. Supreme Court as early as Friday while it prepares an appeal of Shelby’s ruling to the Denver-based 10th U.S. Circuit Court of Appeals, said Ryan Bruckman, a spokesman for the Utah attorney general’s office.

Bruckman has said counties that fail to comply could be held in contempt of federal court.

The holdouts said they decided to obey Shelby’s ruling despite reservations and questions about their legal liability. Utah makes it a misdemeanor for county clerks to sanction a same-sex marriage.

San Juan County Clerk Norman Johnson said “what finalized it for me” was Gov. Gary Herbert’s order to state agencies to comply with Shelby’s decision and change procedures for the delivery of state services. To that end, the Utah Department of Workforce Services is recognizing gay couples for food stamp and welfare benefits.

Herbert called Johnson’s directive the “final straw.”