Mitt Romney, right, talks to Vietnam War veteran Bob Garon at Chez Vachon Restaurant in Manchester, N.H. Garon, who says he is gay, asked Romney about the Defense of Marriage Act. (BRIAN SNYDER/REUTERS)

For the most part, the Republican candidates for president have avoided engaging in public the contentious subjects of gay rights and same-sex marriage. But the people they meet in diners and coffee shops sometimes have other plans.

On Sunday, Texas Gov. Rick Perry was heckled by protesters after his campaign released an ad criticizing gays in the military. In recent weeks, Michele Bachmann has been grilled twice about her opposition to gay unions — once by a high school student, the second time by an 8-year-old boy.

During a routine campaign stop Monday in Manchester, N.H., Mitt Romney warmly greeted a flannel-clad Vietnam War veteran at a cafe. But the man, Bob Garon, proceeded to excoriate Romney for backing laws that define marriage as exclusively between a man and a woman and bar same-sex married couples from receiving spousal benefits.

“A veteran and a spouse would not be entitled to any burial benefits, or medical benefits, or anything that the serviceman has devoted his time and effort to his country. And you just don’t support equality in terms of same-sex marriage?” said Garon, 63, who was having breakfast with his husband.

“I believe that marriage is a relationship between a man and a woman,” Romney replied, adding: “We apparently disagree on that.”

As the GOP candidates try to win over voters face to face, they are finding themselves confronted forcefully and repeatedly on an issue that ranks low as a national priority compared with the economy but high on the emotional scale. And their sometimes unsteady responses are being circulated almost instantly on the Internet.

The GOP candidates have been more sure-footed on the economy than on divisive social issues such as illegal immigration. But illegal immigrants are unlikely to confront a candidate in person, while people who feel affronted by the candidates’ views on gay rights have not hesitated to publicly air their grievances.

“People are outraged that these candidates are actively supporting discrimination and stirring the pot, so people are rightly speaking up for themselves and wanting to make the candidates’ lives a bit difficult,” said Fred Sainz, a spokesman for the gay rights organization Human Rights Campaign, which has endorsed President Obama for reelection.

Gay rights may be gaining prominence, in part, because the first nominating contests are taking place in Iowa and New Hampshire, two states where same-sex marriages became legal following the 2008 presidential election. Conservatives in both states are now trying to reverse course, with lawmakers in New Hampshire set to vote next month on whether to replace same-sex marriage with civil unions.

Americans have become more accepting of gay rights in the past five years. A slim majority support same-sex marriage, according to a Washington Post-ABC News poll released in March. And 77 percent of respondents to a December 2010 poll said they believe gays and lesbians should be permitted to serve openly in the military. That poll was released days before the House voted to repeal “don’t ask, don’t tell.”

Most of the GOP hopefuls ­criticized the decision to lift “don’t ask, don’t tell” and support amending the Constitution to define marriage as exclusively between a man and a woman.

Gay rights groups say that while the confrontations are not coordinated, the candidates should expect to be questioned further as they venture out into the public. They say President Obama, who generally opposes gay marriage but has said his opinion is “evolving,” also will be confronted.

Over the years, candidates have come to expect incidents of hostility on the campaign trail, said Terry Holt, a lobbyist who served as a strategist for George W. Bush’s presidential campaigns. But protesters don’t necessarily help their cause, he said. “Radical activists can really undermine the retail nature of American politics,” said Holt, who recalled that Bush often encountered hostility over the Iraq war. “Shouting isn’t persuasive. It’s bullying.”

After giving a speech Sunday at a coffee shop in Ames, Iowa, Perry encountered a handful of hecklers who accused him of demonizing gays and lesbians. Perry’s ad criticized the lifting of “don’t ask, don’t tell,” lamenting that “there’s something wrong in this country when gays can serve openly in the military but our kids can’t openly celebrate Christmas or pray in school.”

Perry did not respond to the shouts, according to media reports, and his supporters tried to drown them out with applause.

At a Bachmann book-signing in South Carolina, an 8-year-old apparently urged on by his mother whispered to the Minnesota congresswoman, “My mom is gay and she doesn’t need fixing.” And at a pizza restaurant in Iowa, a high school student engaged in a debate with Bachmann, asking, “Why can’t same-sex couples get married?”

Bachmann responded: “They can get married, but they abide by the same law as everyone else. They can marry a man if they’re a woman. Or they can marry a woman if they’re a man.”

Both exchanges were videotaped and circulated widely on the Internet.

The Romney exchange in New Hampshire ended when an aide called for the former Massachusetts governor to wrap up the conversation after Garon, the gay Vietnam veteran, asked whether Romney supported repeal of same-sex marriage in the state.

“Oh, I guess the question was too hot,” Garon said.

“No, I gave you the answer,” Romney replied. “You said you had a yes-or-no [question]; I gave you the answer.”

“You did,” Garon said. “Good luck. . . . You’re going to need it.”

“You are right about that,” Romney said as he stood up from the booth.