WASHINGTON - U.S. Sen. Bob Casey stepped into the fray on two of Pennsylvania's most contentious issues Tuesday, saying the state's voter identification law was politically motivated and urging the state to move toward allowing same-sex marriage.

Casey took aim at the controversial ID law as it is being debated in a Harrisburg trial.

"I have no doubt that there was a political motive and it was designed to have an effect on the 2012 election," Casey said, referring to last year's presidential race. The law was stalled by a judge before Election Day.

"When you design something that's meant to have an impact on voting, I would argue, in a negative way, you're really playing with fire, and you should think long and hard before you do it," Casey said in an interview in his Washington office. The Democrat was also up for reelection last year.

State Republicans passed the ID requirement without Democratic support, and it was signed in March 2012 by Gov. Corbett. Several other GOP-controlled legislatures took similar steps leading up to the presidential election that year, saying the laws would prevent voter fraud.

Casey said it was important to have "to get more people to vote instead of erecting barriers."

Democrats and liberal groups have argued that the ID laws in Pennsylvania and other states would suppress the vote among minorities and the poor. Casey said older voters would also be hampered, an issue the law's opponents have raised in court.

"This law was going to be an impediment to voting across the board," Casey said. "It wasn't going to just affect a big city like Philadelphia."

A spokesman for the Pennsylvania Department of State said the law "protects the integrity of every vote by giving us something we don't have now - a commonsense way to verify, to the best of our ability, the identity of each voter at the polls."

"Public opinion polls consistently show citizens across the state support this law," said the spokesman, Ron Ruman.

Casey, who in April announced that he had changed his mind and would support same-sex marriage, said he hoped Pennsylvania laws will "move in that direction" as well.

"It would be a measure of progress," Casey said as courts also take up that battle.

He cited William Penn's focus on religious tolerance when he founded the Province of Pennsylvania.

"It's ingrained in our history to be tolerant of different points of view and have debates about different points of view, and I think Pennsylvania can live up to that foundational principle," Casey said.

The American Civil Liberties Union of Pennsylvania has sued to overturn the state law barring same-sex marriages, and another court fight centers on Montgomery County, where the state is trying to block a county official from issuing marriage licenses to gay and lesbian couples.

"I hope what we have going forward is more of a debate in the state about marriage equality," Casey said.

Public opinion polls show growing support for same-sex marriage in Pennsylvania. A Franklin and Marshall College poll in May suggested that 53 percent of the state's registered voters would support allowing same-sex marriage, compared with 43 percent who opposed the idea.

Contact Jonathan Tamari at jtamari@phillynews.com or @JonathanTamari on Twitter. Read his blog "Capitol Inq" at www.inquirer.com/CapitolInq.