WINSTON-SALEM, N.C. (Reuters) - Transgender people would be allowed to use public restrooms in North Carolina that match their gender identity under a settlement agreement filed on Wednesday that aims to resolve the federal lawsuit over the state’s widely criticized bathroom law.

The consent decree proposed by Governor Roy Cooper, the American Civil Liberties Union and transgender people who sued the state would remove some of the law’s harmful effects, civil rights groups said.

The judge in the case must sign off on the proposal before it takes effect.

North Carolina has been mired in litigation about transgender rights since Republican lawmakers enacted a law in 2016 that restricted bathroom choice in state-run buildings to the sex on people’s birth certificates rather than their gender identity.

A measure passed in March rescinded the so-called bathroom bill known as HB 2 and helped bring back some business and sports events pulled from the state in protest. But activists said transgender people still faced discrimination under the new law, which left state lawmakers in control of bathroom policies.

The consent decree says that under current state law, transgender people are not prevented from using their preferred public facilities.

“For too many reasons, it is not in our state’s best interest to remain in drawn-out court battles that still linger because of HB 2,” Cooper, a Democrat, said in a statement.

Republican legislative leaders, who intervened in the court dispute, were not part of the agreement. They had no immediate comment.

Cooper on Wednesday also signed an executive order that bars state agencies and those who have contracts with the state from discriminating on the basis of gender identity or expression.

Activists were pleased by both actions but said they would continue to fight for full nondiscrimination protections for lesbian, gay, bisexual and transgender people in the state.

“Nothing can make up for the cruel and senseless attacks transgender people have faced in NorthCarolina, but I am hopeful that the court will agree to clarify the law so that we can live our lives in less fear,” said Joaquín Carcaño, a transgender man and the lead plaintiff in the lawsuit.

Tami Fitzgerald, executive director of NC Values Coalition, which supported HB 2′s bathroom restrictions, criticized the consent decree and executive order.

The “actions today constitute a massive power grab, with sweeping changes that only the legislative branch has the authority to enact,” she said in a statement.

(Reporting by Colleen Jenkins; Editing by Peter Cooney)