By ADAM BEAM, Associated Press

FRANKFORT, Ky. (AP) — When Kentucky's GOP-dominated legislature made changes to the state's troubled pension system, thousands of teachers protested by rallying at the state Capitol and forcing the closure of more than 30 school districts.

Republicans worried the vote would haunt them in November. Their fears seemed warranted in May, when House Majority Floor Leader Jonathan Shell was defeated by a high school math teacher in a Republican primary who had never run for public office before.

But on Tuesday, there was no teacher backlash at the polls. Of the 49 Republican legislators who voted for the bill and ran for re-election, four of them lost. That includes Republican Rep. DJ Johnson, who lost by one vote in a race that could be headed to a recount.

Meanwhile, eight lawmakers — including five Republicans — who voted against the pension bill were defeated or are trailing in either the primary or general election. They included Democratic Rep. Linda Belcher, a former public school teacher and administrator, and Republican Rep. Phil Moffett, who lost to special education teacher Tina Bojanowski.

The results have encouraged some of the legislature's Republican leaders, who are urging their members to be less timid when the legislature reconvenes in January.

"My message to Republicans in this election is that you can take a tough vote on a controversial issue and run for re-election in a difficult environment and still win," said Damon Thayer, the Republican floor leader in the state Senate. "If you go out and run a good campaign and explain to people why you vote the way you voted, you're not going to get punished for it."

House Democratic leader Rocky Adkins said Democrats were thwarted by a combination of "dark money" GOP ads and President Donald Trump's Kentucky visit in early October, which he said energized Republican voters.

"I don't think the conclusion can be drawn on just that one issue," he said.

Democrats also benefited from outside spending. The political action committee Kentucky Family Values, whose donors include the Kentucky Education Association, spent more than $1.1 million during the election.

Republican state Rep. Phillip Pratt voted for the pension bill. By the fall, he was locked in a close race with Jenny Urie, a high school history teacher. She campaigned on the pension issue, posting videos of some of the teacher rallies at the Capitol and pledging to protect the pensions if elected. Urie said the Republican Party of Kentucky responded by mailing ads to voters comparing her to Nancy Pelosi and Hillary Clinton. She lost by more than 3,000 votes.

"That energy we had about the pension bill got overshadowed by the nationalization of our campaign," she said. "What is current in the news kind of overshadowed things that happened nine months ago."

The results could be troubling for Democrat Andy Beshear, the attorney general who is running for governor in 2019. Beshear has focused his campaign on support for teachers, including picking an assistant high school principal as his running mate. As attorney general, he sued to overturn the pension law, arguing the case himself before the state Supreme Court in September. A ruling is expected next month. But the election results indicate the issue of teacher pensions might not have the political power Beshear was counting on.

But Beshear is confident courting teachers will be a winning strategy for him, mostly because of Republican Gov. Matt Bevin's comments criticizing teachers who oppose his policies.

Jonathan Shell, the former House majority leader who lost to a teacher in the Republican primary, says he believes Republicans will keep winning if they stick to their principles.

"They don't need to listen to the protests and the mobs," he said.