TALLAHASSEE, Fla. (AP) — Amid a contentious and emotionally charged debate over guns and school safety that has roiled the Florida Legislature, leading lawmakers have struggled this past week to reach a deal on a new $87 billion budget.

Republican legislators said Wednesday they thought they had reached an agreement on key elements behind closed doors, but the agreement comes too late for lawmakers to end their 60-day session as scheduled.

Senate President Joe Negron said that he expects legislators will be forced to vote on the budget this coming Sunday. Florida has a 72-hour "cooling off period" to make sure everyone can read the budget before the final vote.

Top legislators said the stalemate over the last two days was due primarily over a disagreement on how much money should go to hospitals that treat Medicaid patients.

But the delay prompted speculation — including from some legislators — that the budget deal was not reached in order to ensure that legislators would vote for a contentious gun bill drawn up in the wake of the shooting at Marjory Stoneman Douglas High School. That bill narrowly passed the Senate on Saturday and was approved by a tight margin in the House on Wednesday.

Legislators routinely seek funding for hometown projects in the state budget. In the few budget meetings that were held publicly, several House members who had said they were unlikely to vote yes on the bill had projects yanked from the budget. Rep. Patricia Williams, a Lauderdale Lakes Democrat, said during debate that she had been subjected to "arm twisting" ahead of the vote.

House Speaker Richard Corcoran earlier this week denied that any legislator would be punished due to their vote and said that if he intended to do that then all legislators threatening to vote no would have lost their projects.

Sen. Rob Bradley, the Senate budget chairman, also said the budget was not being used to convince legislators one way or the other on the bill.

"Every senator voted his or her conscience, there was no carrot and sticks when it came to that particular legislation," Bradley said.

The final budget is expected to increase spending on public schools by about $100 per student; set aside money for the state's Florida Forever land conservation program; and increase spending on financial aid programs for college students. The budget does not include an across-the-board pay raise for state employees.