Missouri lawmakers on Friday overturned a pending state law that would have banned private chatting between teachers and students on social media sites such as Facebook.

The law was blocked by a judge who ruled it would have a chilling effect on free speech. He issued a preliminary injunction at the request of the Missouri State Teachers Association.

Lawmakers originally approved the clampdown on teacher-student communications in response to cases around the country where contacts outside the classroom led to sexual or other inappropriate relationships. Teachers argued that the vast majority of their online contact with students was strictly for educational purposes.

The reversal of the law passed the state House 139-2 on Friday. It had previously passed the state Senate. Gov. Jay Nixon now will decide whether to sign it.

Nixon earlier had asked lawmakers to overturn the law, saying social media are important to teaching and learning.

The revised law no longer would require all districts to ban social media contacts but it does order each district by March 1, 2012, to set electronic media policies to prevent improper communications between staff members and students.

The teachers association testified in favor of the amended bill, but spokesman Todd Fuller said Friday that individual school districts could pass policies imposing the very restrictions teachers are concerned about.

We are going to have to address this issue with specific school districts to make sure they are not violating the rights of teachers, Fuller said.

(Editing by Greg McCune)