MONTGOMERY, Ala. — Alabama lawmakers on Wednesday approved a compromise plan on how to spend the state’s nearly $1 billion in oil spill settlement funds, breaking a deadlock that had divided lawmakers along geographic and policy lines.

The plan, drafted in a conference committee earlier in the day, will use the money for a mixture of paying state debts, shoring up the state’s Medicaid program over the next two years and building roads in the two coastal counties.

Alabama Gov. Robert Bentley, in a Wednesday press conference, said he expects to sign the bill and said it will help prevent immediate cuts to the state’s Medicaid program.

“I truly believe this is a victory. This is a victory for the people of the state of Alabama, especially those who cannot help themselves,” Bentley said.

Under the settlement with BP, Alabama’s general fund will receive $1 billion over the next 18 years to compensate for economic damages incurred during the largest offshore oil spill in U.S. history.

Of the remaining $850 million in payments owed to the state, lawmakers plan to take a smaller amount up front — a projected $640 million — by doing a bond issue.

The compromise plan approved Wednesday will steer $120 million to south Alabama road projects and $120 million to Medicaid over the next two years. It will also use $400 million to repay money borrowed from other state coffers during past budget shortfalls.

Lawmakers argued it was a better financial move to get the money in a lump sum payment while bond rates were favorable.

The House of Representatives approved the conference committee’s plan on an 87-9 vote. Senate approval followed with a 22-8 vote.

The bill was the major product of a special session called by Bentley on a proposed state lottery and other ways to try to get additional money to the state’s Medicaid program. After lottery legislation died, the oil spill settlement bill took center stage.

Rep. Steve Clouse, chairman of the House general fund budget committee, said the bill provides a temporary fix for next year’s Medicaid budgetand will help the following year.

“I don’t want to give anybody the false impression we’ve solved the Medicaid problem. We haven’t. It’s just temporary,” Clouse said.

Some lawmakers unsuccessfully pushed to have more money go to Medicaid, saying the state faces a looming fiscal train wreck in coming years as costs in the health care program grow.

Some of the divisions in the Legislature fell along geographic lines. The House had initially approved a bill that would have steered $191 million to road projects in Mobile and Baldwin counties, and south Alabama lawmakers fought to keep some money for the coast in the compromise plan.

“Mobile and Baldwin counties had suffered the consequences from the BP oil spill back in 2010. We felt it was only fair to get our fair share to take back to Mobile and Baldwin counties,” Sen. Vivian Figures, D-Mobile, said.

Senate President Pro Tem Del Marsh, R-Anniston, warned lawmakers that they risked getting nothing if they remained entrenched.

“There was compromise on all sides,” Marsh said.

Alabama’s Medicaid program provides health care for one million low-income Alabamians, many of them children or nursing home residents.

Kimble Forrister, state coordinator for Alabama Arise, an advocacy group for the poor, said he was pleased the Legislature found a way to prevent immediate cuts to Medicaid, but said Alabama needs a permanent funding solution.

“Still, the bottom line is that we got yet another temporary solution. Vulnerable Alabamians’ access to health care shouldn’t be left up to stopgaps or one-time money,” Forrister said.