President Obama said Friday that North Carolina and Mississippi's laws limiting protections for transgender, lesbian, gay and bisexual people are "wrong" and "should be overturned."

Speaking at a news conference in London with British Prime Minister David Cameron, Obama praised Americans living in states that have recently taken steps to single out individuals based on their gender identity or sexual orientation, even as he criticized their approach to the issue. The North Carolina bill requires individuals to use the bathroom that matches the gender listed on their birth certificate and restricts local governments from providing specific protections based on sexual orientation and gender identity. Mississippi's law allows people to withhold services from lesbian, gay, bisexual and transgender individuals on religious grounds.

The U.K. Foreign Office issued a recent advisory warning British citizens they could face discrimination in parts of the United States based on their sexual orientation or gender identity.

"The U.S. is an extremely diverse society and attitudes towards LGBT people differ hugely across the country," the advisory on its website says. "LGBT travelers may be affected by legislation passed recently in the states of North Carolina and Mississippi."

Obama assured Britons they should feel free to travel throughout America, even though he criticized laws targeting members of the LGBT community.

"I want everybody here in the United Kingdom to know that the people of North Carolina and Mississippi are wonderful people.  They are hospitable people.  They are beautiful states, and you are welcome and you should come and enjoy yourselves," he said. I also think that the laws that have been passed there are wrong and should be overturned."

"And they’re in response to politics, in part; in part, some strong emotions that are  generated by people--some of whom are good people--but I just disagree with when it comes to respecting the equal rights of all people, regardless of sexual orientation, whether they're transgender or gay or lesbian," he added. "And although I respect their different viewpoints, I think it’s very important for us not to send signals that anybody is treated differently."

In recent weeks White House officials have criticized the North Carolina law, as well as similar measures in other states. But this marked the first time the president has spoken out on the subject.

At least five federal agencies, including the Education Department, are examining whether they can withhold money from North Carolina in response to its new law. The Republican sponsor of a similar law in Tennessee withdrew it after the state's GOP governor joined business groups and others in criticizing it, and the Tennessee attorney general issued an opinion saying that the state risked losing as much as $1.3 billion in federal funds for education if the bill became law.

At a youth town hall in London, President Obama got an emotional question from an audience member. (The White House)

William Wan contributed to this report.