HELENA, Montana — Montana’s governor on Thursday signed a bill that codifies the right of people to challenge government regulations that interfere with their religious beliefs.

The legislation, by Republican Sen. Carl Glimm, requires the government to have a compelling reason to violate a person’s constitutional right to freedom of religion and to meet its goals in the least restrictive way possible.

“Citizens should not be left defenseless when their government attempts to burden their ability to live and worship according to their faith. This law provides a sensible balancing test for courts to use when reviewing government policies that infringe upon the religious freedom rights of Montanans,” the Alliance Defending Freedom said in a statement.

Supporters have said such laws have been used to defend a Native American charged with illegally possessing eagle feathers, when they had them for religious purposes, and to uphold a student’s right to mention their faith in God during a graduation speech.

Opponents fear the law will allow businesses to challenge ordinances in cities that have local ordinances prohibiting discrimination in housing or employment based on sexual orientation or gender identity.

“This (law) allows individuals to turn the shield of religious freedom we all hold dear into a weapon to attack LGBTQ and Indigenous Montanans,” said Shawn Reagor, director of Equality and Economic Justice with the Montana Human Rights Network. “It goes against the live-and-let-live values we hold as a state, recent court rulings, and the ordinances of five Montana cities and counties.”

Lt. Gov. Kristen Juras told the House Judiciary Committee in March that Gov. Greg Gianforte supported the bill and “emphasizes this is not a license to discriminate against the LGBT.”

Montana joins 21 states with their own religious freedom restoration acts. The laws are similar to the federal Religious Freedom Restoration Act, signed in 1993 by Democratic President Bill Clinton, which allows federal regulations that interfere with religious beliefs to be challenged.