Until recent weeks, this old mining town tucked in the mountains of southeast Arizona was known as a mecca for artists, retirees, and tourists who linger in eclectic shops, bookstores, and cafés. Now many also regard it as a beacon of hope for gay rights.

In a state with a conservative edge, Bisbee, population 5,600, in early April became the first municipality in Arizona to legalize same-sex civil unions. On Tuesday, after threats by Arizona's attorney general to sue Bisbee for exceeding its powers and interfering in state affairs, town leaders tweaked the ordinance to omit references to "spouses" and "marriage" and to refer to its civil unions only as contractual agreements.

But the intent is still the same – to lay down a marker that, inside these city limits, a red state becomes a blue oasis on the issue of gay rights. And Bisbee is not alone.

From St. Paul, Minn., to Lawrence, Kan., to Columbia, Miss., municipalities across the country are increasingly crafting laws to offer some rights to same-sex couples and gay individuals in defiance of their own states. The trend has occurred as public opinion grows more favorable toward same-sex marriage, with the success of local gay rights ordinances often depending on how much leeway state courts give localities in interpreting state laws.

Despite some legal setbacks – as in Bisbee – "in the overwhelming number of those cases, the local governments have prevailed," says Jennifer Pizer, an attorney with Lambda Legal, the nation's oldest legal organization working for gay rights.

In Tampa, Fla., the increasing willingness to embrace gay rights was reflected in a local ordinance unanimously passed last year that set up a domestic partnership registry allowing legal protections for same-sex couples involving matters such as medical decisions and hospital visitations.

"Things went very smoothly here," says Kate Taylor, assistant city attorney in Tampa. "We had very little opposition at the public hearings."

In other places, attempts to offer protections for gay people, which many see as a step toward same-sex marriage, have been volatile. In Pocatello, Idaho, a community with a significant Mormon population, the city council narrowly rejected an ordinance in April aimed at making discrimination based on sexual orientation or gender identity a misdemeanor crime. A month earlier, after Royal Oak, Mich., adopted an ordinance to ban discrimination against gays in housing and employment, a petition seeking to repeal the measure by referendum put it on hold.

In Bisbee, the town's foray into same-sex recognition drew fiery opposition. On the night the city council originally approved the ordinance, several people chastised members for flouting "God's law."

The conservative Center for Arizona Policy, which supported Arizona's 2008 constitutional amendment that defined marriage as being between a man and a woman, deemed Bisbee's actions illegal.

Gene Conners, the Bisbee councilman who proposed sanctioning civil unions, says meetings between town attorneys and Arizona Attorney General Tom Horne led to the revised ordinance announced Tuesday. The original measure would have given those in same-sex civil unions the same rights as married couples in areas including community property and inheritance, and that is beyond the town's jurisdiction, Mr. Horne said at a recent news conference.

To placate Horne, Bisbee took out of its civil-union ordinance references to inheritance, property, and adoption rights. The compromise shows how, over the years, cities and towns have devised myriad creative ways to offer same-sex couples legal protections while trying to not overstep their authority, says Ms. Pizer of Lambda Legal.

Whether local ordinances can pass legal muster depends on how wide the gaps are between cities and states and whether courts are willing to reconcile the two sets of rules, says Marc Spindelman, who teaches family and constitutional law at Ohio State University.

In Michigan, for instance, the Supreme Court interpreted the state's marriage amendment to prohibit same-sex marriages, civil unions, and domestic partnerships. So "there was less room for local governments and sub-state entities like universities to act," he says.

By contrast, local jurisdictions in Ohio have more leeway. That's because the state's top court interpreted Ohio's marriage amendment to prohibit "only marriage in its full equivalent, like a civil union, which gives all the same rights, benefits and protections to same-sex couples that married straight couples receive," Professor Spindelman says.

The Bisbee ordinance merely intends to provide some legal protections within its limits to same-sex couples that are routinely afforded to heterosexuals, says city attorney John MacKinnon.

"Our intent here is to do everything we can, as a small jurisdiction, to right this wrong and to try to put an end to legal discrimination against members of our community," he adds.

It remains to be seen if the new ordinance will satisfy Horne, but for now, his office plans no legal action against the town.

"As long as Bisbee passes an ordinance that does not change state statute, then passing an ordinance will not be an issue," says Stephanie Grisham, Horne's spokeswoman.

She points to Phoenix as having the type of ordinance that adheres to state guidelines. In Arizona's capital, same-sex couples can pay a fee to add their names to a city registry that grants partners the right to hospital visitations. Tucson and Flagstaff give the same right as well as recognition to gay couples at any libraries and other government facilities within the city.

Richard Melnick, a Bisbee resident who is gay, calls Bisbee's effort to recognize gay unions highly symbolic.

"It's telling that this tiny town wants to do the right thing and offer equal rights, basically, to all of its citizens."

Mr. Melnick, who moved to the community from his native San Francisco a year ago, feels at home here.

"People have always said Bisbee's the blue dot in a red sea," adds Melnick, who works at an antique store in the town's historic district, not far from the restored Victorian houses clustering hillsides. "You have so many people like myself that move here because they feel so welcome. This to me is mini-San Francisco."

His boss, Kathy Sowden, looks forward to the day when she can go to City Hall with her longtime partner, Deborah Grier, and make their union official in the eyes of the law.

"We've been together for 20 years, and if there's any level of legal protection for our relationship we're going to take it," she says.

She and her partner have not faced a crisis that tests the legal boundaries of their relationship, but Ms. Sowden says both would like to be prepared. "What concerns me is, if one of us was in a bad accident, would the other one be able to even go into the hospital room?" she adds.

People like Jeff Hearn, who moved to Bisbee some 40 years ago with his late wife, says he has no problems with laws that advance gay rights. "Live and let live, it's a good thing," he says.

For her part, Lambda Legal's Pizer says anti-gay marriage laws like the one in Arizona don't impede municipalities from sanctioning civil unions.

Get the Monitor Stories you care about delivered to your inbox. By signing up, you agree to our Privacy Policy

"Arizona's amendment is about marriage," says Pizer, who is providing legal assistance to Bisbee. "The voters in Arizona were offered an opportunity to pass a broader amendment that would've prohibited domestic partnership, and the voters rejected that proposal and what they passed instead was just about marriage."

She adds: "What that means is that the state and local governments have some considerable room to fashion other kinds of legal protections for same-sex couples."