South Dakota Gov. Dennis Daugaard on Friday signed a bill allowing teachers to carry guns in school, making his state the first to enact such a law since the Newtown shooting tragedy.

The bill was pushed by gun-rights supporters who say arming teachers could help prevent tragedies like the one at Sandy Hook Elementary School, where 20 students and six educators died. The law, which goes into effect July 1, will allow school districts to arm teachers and other personnel.

But the measure prompted intense debate in the capital, as several representatives of school boards, school administrators and teachers opposed the bill during committee testimony last month. They said the measure could make schools more dangerous, lead to accidental shootings and put guns in the hands of people who are not adequately trained to shoot in emergency situations.

The issue of guns in schools has been a contentious one. The National Rifle Association, several days after the Newtown shooting, proposed installing armed officers or guards in schools across America -- an idea that was met with derision by gun control advocates. Democrats on Capitol Hill in Washington have since moved ahead on gun control legislation, including an anti-trafficking measure that passed out of Senate committee Thursday -- while at the state level, Republican-led states have tried to enhance gun-rights protections.

In South Dakota, main bill sponsor Rep. Scott Craig, R-Rapid City, said earlier this week that he has received messages from a growing number of school board members and administrators who back it. Craig said rural districts do not have the money to hire full-time law officers, so they are interested in arming teachers or volunteers.

South Dakota doesn't stand alone on this issue. For a dozen years, Utah has allowed teachers and others with concealed carry licenses to wear a gun in a public school. A couple of school districts in Texas have been given written authorization to allow guns in schools. And legislatures in other states, including Georgia, New Hampshire and Kansas, are working on measures similar to South Dakota's.

The measure does not force a district to arm its teachers and would not force teachers to carry a gun.

On Monday, the South Dakota House voted 40-19 to accept the Senate version of the bill, which added a requirement that a school district must decide in a public meeting whether to arm teachers and others. Another Senate amendment allowed school district residents to push a school board's decision to a public vote.

The Associated Press contributed to this report.