President Obama waded into North Carolina state politics Friday, even as he visited the United Kingdom for official meetings and to celebrate Queen Elizabeth's 90th birthday.

During a press conference in London, the president came out forcefully against the state's transgender bathroom law, saying the legislation was "wrong" and should be "overturned."

"The people of North Carolina and Mississippi are wonderful people. They are hospitable people. They are beautiful states," Mr. Obama told reporters Friday. "I also think that the laws that have been passed there are wrong. And should be overturned."

Get Breaking News Delivered to Your Inbox

The president attributed the anti-LGBT law in North Carolina -- which stops local governments from passing anti-discrimination rules and requires transgender students to use bathrooms assigned to their biological sex at birth -- as "in part" a response to politics and also to "some emotions that are generated by people."

"Some of whom are good people," he qualified. "But I just disagree with them."

"When it comes to respecting the equal rights of all people, regardless of sexual orientation, whether they're transgender or gay or lesbian -- although I respect their different viewpoints -- I think it's very important for us not to send signals that anybody is treated differently," the president said.

Prime Minister David Cameron also weighed in on the debate, which has roiled U.S. presidential politics in recent days.

The laws, Cameron noted, were "a matter for their own legislatures" to decide. But he added that laws should be used "to end discrimination, rather than try to enhance it."

During the press conference, President Obama also commemorated the passing of Prince.

"I loved Prince because he put out great music and he was a great performer," he said. While he didn't "know him well," the president praised the late pop musician as "extraordinary and creative."

The president added that, prior to his meetings Friday with British officials, he and his staff took a moment out of the day and listened to two Prince hits: "Purple Rain" and "Delirious."