Officials in New Mexico's lakeside town of Elephant Butte on Wednesday changed their leash law to let community icon-turned-national media star Blue the dog continue roaming free, within the confines of a wireless fence.

The vote ended a closely watched, months-long dispute over whether the blue-eyed Australian heeler, who became a fixture in the town after being abandoned more than a decade ago, should be subject to the town's ordinance.

Blue's attorney and caretakers at the Butte General Store & Marine initially sought an exemption for Blue, citing his popularity in the community and friendly demeanor. After city officials refused, they reached a compromise to include wireless fences as an acceptable restraint under the law.

Blue has been hanging around the store for years. He has refused numerous attempts at adoption, so community members have built him an air-conditioned and heated dog house. Store visitors regularly donate cash for his care.

Blue's fight over city demands that he be leashed or confined made national headlines and earned him more than 3,700 Facebook friends.

Janice Conner, who owns the general store with husband Bob Owen, said it's been a long saga, but one that ended well for Blue, the community and dog lovers around the world.

"In his name, people have donated money to people with other dogs in need," she said in a telephone interview. "Dogs have been adopted through his Facebook page. All around, it has been a real positive thing."

At the local level, the ordinance change protects other dog owners from being threatened with the potential loss of a dog, said Albuquerque attorney Hilary Noskin, a lake property owner who took the case pro bono. Under the new ordinance, pet owners must be given warnings before a dog can be picked up by animal control, and any complaints about a dog must be verified before pet owners are cited, she said.

Conner said Blue's troubles began after baseless complaints about his free-wandering ways that followed a fatal pit bull attack in Truth or Consequences, about two miles away.

Conner said Invisible Fence of New Mexico donated a fence that gives Blue about an acre of territory to roam around the store.

"They did a lot of training with him, but it's going to take a while," she said of the system that delivers a shock-like jolt through a dog's collar when it crosses a defined perimeter. "He has gone out one time, and he fought coming back through it."