AUSTIN, Texas (Reuters) - A new law went into effect in Texas on Monday that allows certain students to bring guns into classrooms, with supporters saying it could prevent mass shootings and critics saying the measure will endanger safety on campuses.

A student walks at the University of Texas campus in Austin, Texas, U.S. on June 23, 2016. REUTERS/Jon Herskovitz/File Photo

The so-called state “campus carry” law allows people 21 and older with a concealed handgun license to carry pistols in classrooms and most buildings throughout public universities, including the University of Texas system, one of the nation’s largest with an enrollment of more than 214,000 students.

The law took effect as the university held a memorial to mark the 50th anniversary of one of the deadliest U.S. gun incidents on a college campus. On Aug. 1 1966, student Charles Whitman killed 16 people in a rampage, firing from a perch atop the clock tower at the University of Texas at Austin, the state’s flagship public university.

Governor Greg Abbott, a Republican who supports campus carry, said a gunman could already bring a firearm on to campus, and the law could prevent mass shootings because someone with a licensed concealed weapon could be ready to confront a gunman.

“What campus carry does is that it only authorizes those who go through the special training and background” to carry firearms, his office quoted him as saying.

University of Texas professors lobbied unsuccessfully to prevent the law, arguing the combination of youth, firearms and college life could make for a deadly situation. University President Gregory Fenves reluctantly allowed campus carry, saying he was compelled to do so under state law.

Last month, three professors sued to block the law, saying it could have a chilling effect on academic freedom. Attorney General Ken Paxton, a Republican, said the law was constitutionally sound and he would defend it.

The law allows private colleges to opt out, and most of the state’s best-known private universities have done so, saying the measure runs counter to protecting student safety.

Eight states allow people to carry concealed weapons on public post-secondary campuses, according to the National Conference of State Legislatures.

At the Austin campus, third-year graduate architecture student Rachel Warburton said she was against campus carry since it runs counter to the idea that a university should be open and safe for all.

“It brings an air to the campus that you don’t feel safe and you feel that you always have to be protected,” she said ahead of the memorial.