Arizona Gov. Jan Brewer announced Wednesday she has vetoed a controversial bill that would have allowed religious beliefs as a defense for denying service to gays and others.

Brewer, who spent several days considering whether to sign the bill, said it had "the potential to create more problems than it purports to solve.It could divide Arizona in ways we cannot even imagine and no one would ever want."

Democrats and civil rights groups opposed the measure backed by social conservatives, saying it would allow discriminatory actions by businesses and hurt the state's economy by driving away business. Several prominent Republicans also had urged Brewer in recent days to reject the bill in recent days.

Among the first to congratulate Brewer for her decision Wednesday was Arizona Republican Sen. John McCain, who had urged her to veto the measure.

"I appreciate the decision made by Governor Brewer to veto this legislation. I hope that we can now move on from this controversy and assure the American people that everyone is welcome to live, work and enjoy our beautiful State of Arizona," McCain said in a statement.

The Arizona Legislature passed the bill last week allowing businesses whose owners cite sincerely held religious beliefs to deny service to gays and others. It allows any business, church or person to cite the law as a defense in any action brought by the government or individual claiming discrimination.

The legislation caused a national uproar, with the business community, the state's Super Bowl Committee and both Republican U.S. senators calling for a veto. Former GOP presidential nominee Mitt Romney also weighed in and urged Brewer to veto the bill.

Brewer's announcement came hours after Major League Baseball and the National Football League joined a growing chorus of business organizations denouncing or expressing strong reservations about the legislation.

Echoing calls for Arizona boycotts previously stirred by Brewer's support for tough measures to clamp down on illegal immigration, the Hispanic National Bar Association also said on Wednesday that its board had voted unanimously to pull its annual convention from Phoenix in light of last week's passage of the bill.

In her remarks to reporters, Brewer said the bill "does not address a specific and present concern related to religious liberty in Arizona.I have not heard of one example in Arizona where a business owner's religious liberty has been violated."

She also said it was "broadly worded and could result in unintended and negative consequences."

The Associated Press contributed to this report