WASHINGTON (CNN) -- The Senate on Wednesday narrowly rejected a controversial measure to allow people to carry concealed weapons from state to state.

A Miami, Florida, gun store offers concealed weapons training.

The measure would have required each of the 48 states that currently allow concealed firearms to honor permits issued in other states.

The vote was 58-39 in favor. The amendment needed 60 votes to pass.

The vote split the Democrats, with 20 supporting the measure and 35 opposing it. Two of the Senate's 40 Republicans -- Richard Lugar of Indiana and George Voinovich of Ohio -- and both independents, Joseph Lieberman of Connecticut and Bernard Sanders of Vermont, voted against it.

Robert Byrd of West Virginia, Edward Kennedy of Massachusetts and Barbara Mikulski of Maryland, all Democrats, did not vote.

A coalition of mayors that fought the law welcomed its defeat.

"Our bipartisan coalition of Mayors Against Illegal Guns fought this amendment tooth-and-nail, because we recognize that the laws of one state may not be best for another," Mayor Thomas M. Menino of Boston, Massachusetts, said in a statement.

"We will continue to work with our members to support common-sense policies and oppose dangerous ones, like the Thune Amendment that was defeated today," he said, referring to Sen. John Thune, R-South Dakota, who sponsored the proposal.

Don't Miss

Gun rights advocates attached a measure allowing people to carry guns in national parks to credit card legislation. President Obama signed the package into law.

The interstate concealed-weapons proposal was an amendment to a larger defense appropriations bill.

Supporters of the measure argued it would help deter criminals; opponents claimed it would, in effect, force most of the country to conform to regulations in states with the loosest gun-ownership standards.

Opponents of the amendment mounted a huge campaign to stop it.

Mayors Against Illegal Guns -- which says it represent more than 450 mayors in 40 states -- took out an ad in USA Today opposing the measure.

"There's no evidence that if you have a gun, you're safer," he said on CNN's "American Morning" Wednesday. "Quite the contrary. If you have a gun at home, [you are] something like 20 times more likely to have somebody in your house killed. ...

"We have to protect our policemen, protect our citizens. We can't have all these guns, and it's reasonable to have each state make their own laws," he said.

"Wyoming shouldn't be subject to New York state laws, and we're going in that direction," he said. "What's right for the people of Wyoming isn't necessarily right for the people of New York and vice versa."

Sen. John Barrasso, a Wyoming Republican who was a co-sponsor of the amendment, had argued that gun licenses should apply across state lines, like driver's licenses.

"People travel," he said on "American Morning."

"We have truck drivers on our roads, people traveling for vacation in their vehicles, and if you have a license ... you should be able to use that license in other states. It should apply like a driver's license," he said.

He argued that concealed weapons deter crime.

"Carrying a concealed weapon is a sign of self-defense, self-protection, and I think it lowers crime," he said.

And he said people carrying guns would still have to obey laws wherever they are.

"The law of the state where that person happens to be at the time are the laws that apply in terms of if you're allowed to carry a gun into a bar or restaurant. ... State rights continue to apply there."

This is the third time the Senate has considered gun rights this year.

In addition to the national parks measure, Senate gun-rights advocates in the spring attached a measure loosening the District of Columbia's tight gun control laws to a bill giving full voting rights to Washington's representative in Congress. That amendment was approved 62-36.

House Democratic leaders, unwilling to loosen the restrictions on gun ownership in the District of Columbia, have let the bill languish.