Massachusetts voters on Tuesday approved Question 3, upholding a state law that prohibits discrimination based on gender identity.

Question 3 was an attempt to repeal a 2016 law that protects transgender people from discrimination in public places such as restaurants and stores.

The victory makes Massachusetts the first state in the United States to uphold such protections at the ballot box.

Kasey Suffredini, Yes on 3 Campaign co-chair, called Tuesday's victory historic.

“Massachusetts made history tonight, both for our transgender neighbors who call this state home and for transgender people across this nation,” Suffredini said in a statement. “Together, we have shattered broken stereotypes of what it means to be transgender and debunked the myth – once and for all – that protecting transgender people compromises the safety of others.”

Carol Rose, executive director of the ACLU of Massachusetts, said that the win was crucial due to the Trump administration's continued attacks on the transgender community.

“Tonight, we sent a message not just to transgender people and their families and friends here in Massachusetts, but to the entire country. At a time when transgender rights are being threatened nationally, we absolutely must preserve the rights we have secured at the state level,” Rose said in a statement.

Opponents of the law said that they mainly objected to it because it allows men to prey on vulnerable women and girls in public restrooms and locker rooms.

Tuesday's outcome was mostly a foregone conclusion, with polls showing wide support for keeping the law on the books.

Laverne Cox, an actress and transgender activist, was among the celebrities who called on voters to keep the law.

(Related: Laverne Cox: With transgender question, Massachusetts can send Trump a message.)