The Utah Legislature voted Friday to override Republican Gov. Spencer Cox's veto of a measure that would prevent transgender girls from participating in female sports in schools across the state.

In a 56-18 vote with a supermajority needed, the Republican-controlled House first voted to override Cox’s veto. Shortly after, the Senate gave final approval to override the veto by a vote of 21-8.

Spencer Cox

Gov. Spencer Cox speaks during a news conference Aug. 31, 2021, in Salt Lake City. (AP Photo/Rick Bowmer, File)

In a statement regarding his veto of H.B. 11, titled Student Eligibility in Interscholastic Activities, Cox said that while "politically, it would be much easier and better for me to simply sign the bill," he vetoed it because he "tried to do what I feel is the right thing regardless of the consequences."

Four GOP lawmakers from each legislative body changed their initial votes in opposition to the measure in order to support the override, according to Utah's Deseret News.

INDIANA REPUBLICAN GOVERNOR VETOES BILL BARRING TRANSGENDER GIRLS FROM FEMALE SPORTS

At least one GOP lawmaker in the House who voted against the measure, state Rep. Mike Winder, did not change his stance. He chose not to vote to override Cox's veto.

"As a fiscal conservative, I cannot vote for a bill to throw away tax dollars in a losing lawsuit or to cost the state in economic opportunities all while only serving as a message of hate while being mired in court. I agree [with Cox]. Utah can do better," Winder wrote in a tweet Thursday.

NCAA protest

Protesters hold signs before the 2022 NCAA Division I women's swimming and diving championship at the McAuley Aquatic Center on the campus of the Georgia Institute of Technology March 17, 2022, in Indianapolis. (Justin Casterline/Getty Images)

State Rep. Kera Birkeland, the bill’s Republican sponsor, said the bill is "purely" about "preserving women’s sports" and warned that when "we don’t act, and we just go with the status quo, we just do more harm to both transgender youth and women athletes."

The Utah Jazz, the state's NBA team, released a statement following the legislature's override.

"The Utah Jazz oppose discriminatory legislation. We are committed to our values of inclusivity, mutual respect and fair play," the statement said. "Beyond basketball, we hope for an equitable solution that shows love and compassion for all our youth."

CLICK HERE TO GET THE FOX NEWS APP

Similar measures have been introduced in other states, some of which have voted to bar transgender students from participating in female school sports.

Eric Holcomb

Republican Indiana Gov. Eric Holcomb  (Ting Shen/Bloomberg via Getty Images)

Earlier this week, Indiana Republican Gov. Eric Holcomb also vetoed a bill that would have prevented transgender females from taking part in female sports, claiming the measure "leaves too many unanswered questions" and questioning the need for intervention at a state level.