After a weekend of heated debate, the Kansas legislature passed a bill that strips teachers of the right to challenge dismissals and ensures tax breaks for corporations that fund private school scholarships. Despite huge majorities in the state House and Senate, the bills passed narrowly over the objections of hundreds of teachers and activists who packed the galleries to protest the bill.

Until now, a teacher with three years of experience was guaranteed the right to receive a written reason for possible termination and the right to appeal the decision. Teachers in Kansas have had the right to due process since 1957. Without it, a teacher could be fired for being gay, or disagreeing politically with an administrator, and have no recourse.

The bill also provides $126 million to address disparities in public school funding. The Kansas supreme court ruled in March that the state’s current funding system is unconstitutional. The court had ordered the legislature to craft a solution before July 1. Some Republican lawmakers sought policy changes like the end of due process in exchange for supporting the funding measure.

Republican Governor Sam Brownback has not said whether he will sign the bill. In a statement, Brownback did not mention the due process part of the bill. “The school finance bill passed by the Kansas Legislature today fully complies with, and indeed exceeds, the requirements of the recent Kansas Supreme Court ruling for funding schools and providing equity,” he said. “The bill ensures that taxpayer dollars are spent efficiently, putting money in the classrooms to help teachers teach and students learn.”

Kansas’ teachers are among the lowest paid in the United States, with the state coming in 42nd in teacher pay. Educators fear that eliminating due process rights for teachers will make it even harder to retain talented teachers. “How do we get great teachers to come to Kansas when they’re already getting paid so little, and now they have no due process?” Aaron Estabrook, a school board member in the city of Manhattan asked msnbc. “How can we recruit them when they won’t be protected?”

Laura Hurla, a fifth grade teacher in Shawnee Heights, near Topeka, told msnbc that even though she trusts her district’s administration to work with teachers, other districts might not be so lucky. “With fewer dollars per pupil and a pay scale based on experience, without any due process for experienced teachers, that’s really scary. We become at will employees,” Hurla said.

LGBT activists also condemned the bill. Tom Witt, the executive director of Equality Kansas, said that the bill will make it easier for homophobic administrators to fire teachers based on their sexual orientation. “There are gay and lesbian teachers in this state who are perfectly good teachers, but the only reason they still have their jobs is, even though their administrators wanted to get rid of them because of their sexual orientation, they couldn’t,” Witt said. “You take away this protection. It’s not like people can go back in the closet.”

The Kansas branch of Americans for Prosperity, the group founded by conservative billionaires Charles and David Koch, had pushed for the change and lauded the elimination of due process for teachers. Jeff Glendening, AFP-Kansas’ state director, called the bill’s passage “a great win for Kansas students.”

Some measures supported by the most conservative members of the legislature did not make it into the final bill. There were provisions that would have blocked funding for Common Core, the nationwide academic standards. There was also a proposal to provide tax credits to parents who send children to private schools or homeschool them.

Estabrook told msnbc that he will push for his district to keep the old system. “I haven’t seen any reason why those protections should be taken away. The process works,” he said. Hurla also said she hopes districts will still negotiate with teachers, but worries about the future. “Our teachers are extremely saddened.,” she said. “Worried about future teachers and losing good teachers to the private sector.”

Kansas has made deep cuts to its education budget in recent years. According to the Center on Budget and Policy Priorities, only seven states cut more funding per student between 2008 and 2013.