Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Roughly a third of Americans say that businesses should be allowed to refuse gay customers on religious grounds, and the figure rises to almost half for businesses that provide wedding services, according to an NBC News poll released on Thursday.

The poll found a sharp political divide on the issue. By a margin of 65 percent to 35 percent, Republicans said that businesses should be allowed to turn away gay customers. Democrats, by a margin of 82-18, said that they should not.

The youngest group of respondents, people aged 18 to 29, were most likely to say that businesses should be required to serve gay customers — a margin of roughly 3-to-1.

The poll, which surveyed 2,052 adults nationwide, was taken Monday through Wednesday, in the wake of a nationwide furor over laws in Indiana and Arkansas that supporters said were designed to protect religious freedom.

Powerful businesses and prominent public figures opposed the laws and said that they could be used to discriminate against gay customers.

In Indiana, lawmakers rushed to amend their law to spell out that no business could use a religious objection as grounds for discrimination. In Arkansas, lawmakers revised a bill so that it more closely mirrored a federal religious freedom law.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

In the poll, conducted by NBC News and SurveyMonkey, 37 percent of respondents said business should be allowed to refuse products or services to gays on religious grounds, compared with 63 percent who said they should be required to provide service.

Demonstrators in favor of a religious freedom bill that Arkansas Gov. Asa Hutchinson wanted rewritten, foreground, gather at the Arkansas state Capitol in Little Rock, Ark., as opponents, left, demonstrate against the bill on April 2. Danny Johnston / AP

For businesses that provide wedding services, such as catering or photography, 48 percent of respondents said they should be allowed to refuse service to gay customers, while 52 percent said they should be required to serve.

In addition, 48 percent of respondents said they would be more likely to boycott a business if it refused gay customers, compared with 14 percent who would be more likely to support it.

On the 2016 election, the poll found that 36 percent of Americans would be more likely to vote for a presidential candidate who supports gay marriage, while 24 percent said they would be less likely.

Respondents for this non-probability survey were selected from among those who have volunteered to participate in the SurveyMonkey Audience panel.

Results have an error estimate of plus or minus 3.0 percentage points.

A full description of our methodology can be found here.

The survey was produced by the Analytics Unit of NBC News in conjunction with the University of Pennsylvania’s Program on Opinion Research and Election Studies with data collection and tabulation conducted by SurveyMonkey.

Analysis was conducted by the University of Pennsylvania’s Program on Opinion Research and Election Studies.

IN-DEPTH

— Allison Kopicki, John Lapinski and Erin McClam