FRANKFORT, Ky. — Taking a cue from their Washington counterparts, Kentucky’s Republican-dominated legislature voted to revamp the state’s tax code on Monday by giving $194 million back to taxpayers but imposing $681 million of new taxes on cigarettes and services like auto repairs.

The tax increases would pay for record-high classroom spending in public schools while eliminating a key funding mechanism for charter schools that had been opposed by teacher unions. It ensures teachers who retired after 2010 but don’t yet qualify for Medicare will have health insurance. And it raises cigarette taxes by 50-cents per pack in a state with among the highest rates of smoking and cancer in the nation.

“I don’t particularly care to be passing tax increases. It’s not generally of my makeup or cloth. But for us to have a change, we had to,” Republican Senate President Robert Stivers said.

Lawmakers raced to pass the tax plan before midnight, ensuring they will get a chance to override a potential veto from Republican Gov. Matt Bevin. Their fears appeared to be warranted, as Bevin issued a warning during the House debate.

“I am very concerned that the current proposals from the General Assembly may not meet these basic standards of fiscal responsibility,” Bevin said in a message posted to his Twitter account. “Our economic future, and everything we expect government to pay for, depends on us doing this the right way.”

Republican leaders were undeterred, with GOP House budget chairman Steven Rudy declaring on the House floor the tax plan will work “no matter what the governor says.”

The Senate passed the bill by a vote of 20 to 18, with seven Republicans joining all 11 Democrats in opposing the measure. The House approved the bill by a vote of 51 to 44, with nine Republicans voting “no.” The bill now heads to the governor’s desk.

Democrats denounced the bill for its secrecy, having been crafted by Republicans in private meetings that excluded input from the minority party. And they scoffed at Republican boasts about funding education, saying the state was still a decade behind on its obligations to public schools.

“This is the Kentucky version of the Trump tax plan,” Democratic Sen. Reggie Thomas said. “All this tax plan does is support the wealthiest and the richest among us.”

Kentucky residents would pay 5 percent of their taxable income to the state. Right now, most people pay between 5.8 percent and 6 percent. That cut alone would cost the state $500 million per year.

But taxpayers wouldn’t get to keep all of that money because the plan eliminates eight tax deductions and a $10 tax credit. Deductions remain for social security income, mortgage interest and charitable giving.

Overall, the cuts will net taxpayers $114 million. But they will likely have to spend all of that money on new taxes imposed on services that had previously been tax-free. Auto repairs would have a 6 percent sales tax added to the bill, as would some home improvements. Rudy said the tax would not apply to a homeowner replacing a heating, ventilation and air conditioning system. But it would apply to replacing a part of that system, such as a compressor.

Democrats worried the taxes would disproportionally harm poor people, who would have to pay a higher percentage of their income to cover the sales tax increases. But Republicans noted the plan broadens the base while lowering the overall tax rate “just like the plan in Washington,” Rudy said.

Other services that would be taxed include landscaping, janitorial, pet care for small animals, fitness and recreational sports centers, golf courses and country clubs, overnight trailer campgrounds and nonmedical diet and weight-reducing centers.

Some businesses would benefit, too. Some large corporations do business in Kentucky, and Kentucky tries to tax their profits generated from within the state. Right now, the state considers a company’s property, payroll and sales in figuring out how much in taxes they owe.

The new bill would only use a company’s sales amount. Jason Bailey, executive director of the Kentucky Center for Economic Policy, says that will benefit large companies with lots of property and employees in Kentucky who export most of their products.