RALEIGH, N.C. (AP) – Gay and transgender rights supporters wasted little time in challenging a new North Carolina law, filing a federal lawsuit Monday that called it discriminatory and said it singles out LGBT people for "disfavored treatment."

The law, which has also drawn strong opposition from major corporations including Apple and Google, was signed by Republican Gov. Pat McCrory last week. The GOP-controlled legislature passed the law in response to a broad Charlotte ordinance that allowed transgender people to use the restroom aligned with their gender identity. The new state law also prevents all cities and counties from extending protections to cover sexual orientation and gender identity at restaurants, hotels and stores.

"By singling out LGBT people for disfavored treatment and explicitly writing discrimination against transgender people into state law, (the new law) violates the most basic guarantees of equal treatment and the U.S. Constitution," the lawsuit said.

With the law, North Carolina became the first state to require public school and university students to use only those bathrooms that match their birth certificates, according to the National Conference on State Legislatures.

Advocates for gay, lesbian, bisexual and transgender rights say state legislators demonized them with bogus claims about bathroom risks. Supporters say the new law protects all people from having to share bathrooms with people who make them feel unsafe.

Two transgender people, a lesbian law professor and several civil liberties groups sued.

Lawsuit defendants include McCrory and the University of North Carolina system, where one plaintiff works and another attends college. The system’s 17 campuses also must comply with the law.

Another defendant is Attorney General Roy Cooper, a Democrat who has criticized the law and wants it repealed. He is challenging McCrory this fall for governor. Cooper is a defendant because his office defends the state in litigation.

Two plaintiffs – UNC-Chapel Hill employee Joaquin Carcano of Carrboro and Payton Grey McGarry, a student at UNC-Greensboro – were born female and now consider themselves male but have not changed their birth certificates.

The lawsuit says Carcano used a designated men’s restroom at work and McGarry used a campus locker room without any problems before the law was passed. Using women’s restrooms could cause them anxiety and fear, the lawsuit says. Now they’ll have to search for bathrooms in other buildings or at local businesses, according to the lawsuit.

Forcing McGarry "to use the women’s restroom would also cause substantial harm to his mental health and well-being," the lawsuit reads. "It would also force him to disclose to others the fact that he is transgender, which itself could lead to violence and harassment."

Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.

Join our Newsletter for the latest news right to your inbox