Updated

President Barack Obama said Wednesday his order that public schools allow transgender students to use the bathroom of the gender they identify with as based on the law and the best interests of children.

Obama, speaking at a town hall broadcast on PBS, said the federal government got involved in the matter after several school districts asked the Department of Education for guidance. However, Obama has been under heavy scrutiny for his directive.

"What happened and what continues to happen is you have transgender kids in schools. And they get bullied. And they get ostracized. And it's tough for them," Obama said. "My best interpretation of what our laws and our obligations are is that we should try to accommodate these kids so that they are not in a vulnerable situation.”

Obama’s directive was issued on May 13. The federal government told public schools they must allow transgender students to use bathrooms that correspond with their gender identity rather than the gender listed on their birth certificate.

If schools failed to heed the order, the Obama administration threatened to cut federal funding. According to Reuters, the order relied on an interpretation of Title IX, which protects people from discrimination based on gender in education programs that receive federal funds.

Outraged over Obama’s order some states have decided they would challenge the White House’s directive in court.

Republican-led Kansas said it will sue the Obama administration over the order, but has not yet decided whether to join a lawsuit brought upon by 11 other states.

The state Senate lauded Attorney General Derek Schmidt for announcing the intent to legally challenge the U.S. Departments of Justice and Education. Texas and 10 other states already have filed suit against the federal government over the directive. Kansas Republican legislators also urged the Republican-majority Congress to blunt the directive by passing legislation that protects privacy rights.

Meanwhile, Texas Republican Lt. Gov. Dan Patrick pledged at a press conference Tuesday to support schools that refuse to let transgender bathrooms of their choice.

"Transgender students deserve the rights of anyone else. It does not mean they get to use the girls' room if they're a boy," Patrick said.

Parents of transgender children rallied outside the Texas Capitol Tuesday, warning that constant repudiation is taking a dangerous toll. They included the mother of a 5-year-old transgender girl who held a picture of her child smiling in a pink patterned dress and shoulder-length hair. She cried while asking why the state wants to force her daughter into the boys' room at school.

She and other parents said Patrick's comments are provoking hostilities in school hallways. Like many other Republicans across the country, Patrick said the privacy and safety of students are put at risk by letting transgender people use the bathroom that matches their gender identity.

"You, specifically you, are endangering my child's life," said Ann Elder, mother of a 10-year-old transgender child near Houston. "You have now told everyone in the state of Texas it is OK to harass my child."

Transgender-rights advocates have said claims of bathroom rights posing a public safety risk are malicious and false. They say that 18 states and scores of cities have experienced no significant public safety problems linked to their existing laws allowing transgender people to use the bathrooms of their choice.

Obama said Wednesday that there are a lot of things “more pressing” than the so-called transgender bathroom policy, including the economy, ISIS and jobs.

"We should deal with this issue the same way we would want it dealt with if it was our child and that is to try to create an environment of some dignity and kindness for these kids," Obama said.

The Associated Press contributed to this report.

Click for more from Reuters.