Bryan Woolston / Reuters A questioner challenged Ohio Gov. John Kasich (R) on his party's stance on gay rights during a town hall in San Francisco.

SAN FRANCISCO -- GOP presidential hopeful John Kasich on Friday distanced himself from discriminatory laws passed recently by some states during a heated exchange with a man who challenged the Republican Party's stance on gay rights.

During a town hall-style event hosted by the Commonwealth Club of California, a 62-year-old San Francisco resident who said he came out to his parents at age 19 asked Kasich if he believes people are born gay.

"Gay people are human beings and not a lifestyle choice," said the questioner.

“I don’t believe in discrimination," Kasich said. "I think there is a balance, however, between discrimination and people’s religious liberties. But I think we should just try to like, take a chill pill, relax and try to get along with one another a little bit better instead of trying to write some law to solve a problem that doesn't quite frankly exist in big enough numbers to justify more lawmaking."

Kasich was apparently referring to so-called religious freedom laws passed in several states in recent years. These measures, like one signed into law in Mississippi this month, allow businesses to refuse to provide services to lesbian, gay, bisexual or transgender people on religious grounds.

The questioner continued to press Kasich, pointing out that the GOP opposes marriage equality in its party platform.

“I haven’t read that thing lately,” Kasich said. “The Republican Party is my vehicle, not my master. I have a right to define the Republican Party. … I believe in traditional marriage. I just went to a gay wedding.”

"Do you feel people are born gay?" the questioner asked again.

"You know Sir, probably," the governor replied. "I don't know how it all works. Are they? In all probability they are. Okay?"

The back-and-forth continued, with the questioner pointing to discriminatory laws like Mississippi's that were passed by GOP legislatures and signed into law by Republican governors.

“They are not me,” Kasich said.

Instead of trying to legislate these issues, Kasich said, people should learn to "tolerate each other's individual beliefs." If a photographer refuses to work at a gay wedding, Kasich said, the couple should find a new photographer. And if a bakery has a potential customer who is gay, they should "sell the cake."

"We cannot be pushing each other’s buttons," he said.

"I'm not going to sign any laws in Ohio that [are] going to create discrimination against anybody," he continued. "I don't see any reason to hurt you or discriminate against you or make you feel bad or make you feel like a second-class citizen. I don't think that's right."

Kasich, who is more moderate on gay rights than many Republicans, has previously hedged on LGBT issues. He has repeatedly said that he does not personally believe in gay marriage, but as president wouldn't fight the Supreme Court ruling legalizing same-sex marriage nationwide. Though he said he would probably would not have signed anti-LGBT bills like North Carolina's HB 2, his advice to people facing discrimination is to "get over it."

"John Kasich can’t have it both ways," said Democratic National Committee spokesman T.J. Helmstetter after the governor's "get over it" comments aired on CNN earlier this month. "Either you're for discrimination, or you're against it."