State House Speaker Thom Tillis (R) faces a balancing act in the legislature (AP Photo/Chuck Burton)

North Carolina Gov. Pat McCrory (R) and state Senate President Phil Berger (R) are members of the same party, but they don’t see eye to eye. Since McCrory took office in 2013, the two have been at each other’s throats constantly, on issues ranging from taxes to election reform to immigration. Now, disagreements between two of the most powerful men in Raleigh over teacher pay and whether to accept federal Medicaid money have kept the legislature in session weeks past their planned adjournment date, while McCrory and Berger take shots at each other in the media.

The budget impasse could resonate far beyond Raleigh: Stuck in the middle, between feuding leaders of his own party, is state House Speaker Thom Tillis (R).

Tillis faces Sen. Kay Hagan (D) in one of the most contentious, most closely-watched Senate contests of the year. Hagan is among four Democrats who represent states Mitt Romney carried in 2012, Democrats the GOP must beat if it is going to retake control of the U.S. Senate.

And while Congress is unpopular, so is North Carolina’s General Assembly. The Hagan campaign, and Democratic outside groups that have poured millions of dollars into attack ads, have made a concerted effort to associate Tillis with his unpopular colleagues in Raleigh.

At issue in the current budget fight: Whether to fund thousands of teaching assistants in public schools, how much to raise teacher salaries, and at what levels to fund Medicaid for low-income children and their parents. The state House, led by Tillis, wants to see a 6 percent pay raise for teachers; the Senate wants an 8 percent pay hike.

McCrory has said he will veto the Senate’s version of the budget, which he said would lead to teacher assistant layoffs and Medicaid benefit cuts. The Republican Senate has threatened to override an earlier McCrory veto.

Internal polls for both Democratic and Republican groups have showed Hagan pulling ahead of Tillis, sources on both sides of the race say, by the low single digits. The nonpartisan Rothenberg Political Report recently gave the race a Tilt Democratic rating, motivated in part by struggles Tillis has had in Raleigh.

“His role in the legislature’s leadership is a factor in his problems,” Stu Rothenberg said in an e-mail.

This wasn’t how the legislative session was supposed to go down. Before reconvening in May, Tillis, McCrory and Republican leaders promised a short session — they hoped to adjourn by July 4 — in which teachers would get a pay raise. Now, the pay raise looks uncertain. If it doesn’t materialize, that hands Democrats the ability to hammer Tillis as an ineffectual leader who doesn’t keep his promises.

“I don’t think there are any Republicans in the legislature here who like the fact that we’re still in session. We had all hoped that we would get out earlier than this, but this is part of the process. We have two chambers for a reason,” said Jordan Shaw, Tillis’s campaign manager. “I think the political costs of doing what some folks have suggested would be very high, and that would be firing thousands of teacher assistants. I don’t think that makes political sense or policy sense.”

Because North Carolina operates on a two-year budget cycle, beginning in the even year, failure to reach an agreement wouldn’t mean a government shutdown. So while the budget urgency doesn’t exist, political pressure is mounting on Tillis and his fellow Republicans to reach a deal.

Tillis has had to mediate between McCrory and Berger before. In 2013, Tillis bridged the gap between the governor and the Senate leader on tax cuts. Tensions between McCrory and Berger ran so hot that Tillis would shuttle between the two to hammer out details.

Tempers are flaring again. McCrory has compared Berger and his fellow Senate Republicans to U.S. Senate Majority Leader Harry Reid — fighting words in Republican circles — while Berger has said the governor is “staging media stunts and budget gimmicks,” according to the Charlotte Observer. The Senate has even threatened to subpoena Art Pope, McCrory’s budget director.

The current budget fight “just reminds people that the only reason that they’re even having this fight in the General Assembly right now is that Speaker Tillis chose tax cuts for the wealthy instead of investments in education,” said Sadie Weiner, a Hagan campaign spokeswoman. The Senate Majority PAC, a Democratic super PAC, has run four paid advertisements criticizing the legislature’s record under Tillis’s speakership.

Conversely, if Republicans are able to reach agreement in relatively short order, Tillis can emerge as a triumphant leader who gets results.

Joe Stewart, executive director of the right-leaning North Carolina Free Enterprise Foundation, said the race will center around both Tillis’s role in Raleigh and Hagan’s in Washington.

“The Hagan campaign and her allies are likely to focus on any aspect of Tillis’s legislative service — whether this session or previous ones — they feel show voters he’s outside the mainstream, where the Tillis campaign and his allies are likely to focus on Hagan’s support of Obamacare and her alignment with President Obama and U.S. Senate Majority Leader Harry Reid as evidence voters should want a change,” Stewart said.

The longer legislative session, some analysts said, has required more hands-on management from Tillis than he initially expected. That also affects his campaign: Tillis’s fundraising has lagged far behind Hagan’s. At the end of June, Hagan reported $8.7 million in the bank. Tillis had just $1.6 million on hand.

The extended session “does present some scheduling challenges, given that Speaker Tillis is trying to spend as much time as he can on budget negotiations and also trying to prosecute a top tier Senate race,” Shaw said. “That’s something we knew was going to be a possibility going into this.”

Outside groups, which have poured more than $34 million onto television and radio advertising this calendar year alone, can make up much of the difference, and national Republicans have made Tillis’s success one of their top priorities.

But Tillis’s slow fundraising pace means those groups will have to spend more in North Carolina than they might have initially expected — all the more so the longer the legislature debates funding for teaching assistants and Medicaid.

Shaw, however, said he was willing to compare records any time. “We’ve done a lot of good things for the people of North Carolina while Kay Hagan has been a rubber stamp for Barack Obama and Harry Reid in Washington,” he said.

Correction: An earlier version of this post inaccurately reported the House proposal on teacher pay raises. It has been corrected.