(Reuters) - A high school math teacher in Kentucky rode a wave of discontent among educators on Tuesday when he defeated a rising Republican star in a primary for a seat in the state’s House of Representatives.

Travis Brenda, 43, pulled a 51-49 percent upset in the race for the state’s 71st district seat over House Majority Floor Leader Jonathan Shell, who had the backing from U.S. Senate Majority Leader Mitch McConnell, a Kentucky Republican, according to local media.

Brenda said Shell called him and conceded, the Lexington Herald Leader newspaper reported.

In victory, Brenda said he credited support from teachers and state workers who were displeased with what lawmakers “did on the pension bill,” the newspaper reported.

Kentucky teachers were among thousands of educators in several states to protest and stage work stoppages during the last couple of months, demanding increases in pay and school budgets.

Kentucky teachers demonstrated in the state capital, Frankfort, in April after lawmakers passed a bill that mandates a hybrid pension plan with individual retirement accounts for new hires.

Shell, a 30-year-old farmer who has held seat since 2012, played a key role in the passage of the controversial measure, according to the Lexington Herald Leader newspaper.

(Corrects typos in paragraph 1)