Donald Trump has had an apparent change of heart about a controversial North Carolina law that targets the LGBT community.

During a campaign stop in Raleigh, the presumptive Republican nominee was asked to weigh in on the law.

“I'm going with the state,” he answered. “The state, they know what's going on. They see what's happening and generally speaking I'm with the state on things like this. I've spoken with your governor. I've spoken with a lot of people and I'm going with the state.”

House Bill 2 has been under fire since it was approved in March during a one-day special session. The law blocks cities from enacting LGBT protections and prohibits transgender people from using the bathroom of their choice in government buildings, including schools.

Passage led to canceled conventions and concerts and even job losses for the state.

In April, Trump blasted the law during a television interview.

“North Carolina did something that was very strong and they’re paying a big price,” he said. “And there’s a lot of problems. Leave it the way it is. North Carolina, what they’re going through, with all of the business and all of the strife – and that’s on both sides – you leave it the way it is. There have been very few complaints the way it is. People go, they use the bathroom that they feel is appropriate. There has been so little trouble. And the problem with what happened in North Carolina is the strife and the economic punishment they’re taking.”

(Related: Donald Trump supports Caitlyn Jenner's right to use the bathroom of her choice.)

LGBT rights groups criticized the move.

“Let’s be clear, Donald Trump just gave one of the nation’s worst laws for LGBTQ people a full-throated endorsement,” said JoDee Winterhof, senior vice president for policy and political affairs at the Human Rights Campaign (HRC). “By buddying up with Governor Pat McCrory on the deeply discriminatory HB2, Donald Trump is unabashedly embracing a dangerous law that takes away the civil rights of LGBTQ people and has cost North Carolina not only its reputation but millions of dollars in economic losses.”

Chris Sgro, executive director of Equality NC, said that the comments show that Trump is “no friend to gay and transgender people.” “We must resoundly reject his ill-informed discrimination in November,” he added.

The comments come just weeks after Trump claimed that he was a better friend to the LGBT community than Hillary Clinton, his presumptive Democratic rival for the White House.