Capping months of uncertainty for school districts across Illinois, Gov. Bruce Rauner on Thursday signed a landmark measure that will reshape the way the state funds public education — declaring “we finally got it done.”

As schoolchildren watched from the bleachers, Rauner signed the bill in a Northwest Side elementary school. The governor was surrounded by Mayor Rahm Emanuel, Illinois Senate President John Cullerton, Republican leaders and the bill’s House and Senate sponsors.

“Today we are making Illinois history,” the governor said, moments before signing the bill, which he said ensures students will get an “equal chance at an excellent education.”

“We finally got it done, Rauner said. “This is a historic day.”

State Sen. Andy Manar, the Bunker Hill Democrat who sponsored the bill in the Senate, said it “wages a war on poverty in the classroom,” and “ends a great racial divide.”

The legislation is intended to put new money for education into the state’s poorest and neediest districts — and to try to ease the state’s reliance on local property taxes to pay for schools. The system has enabled wealthier communities to pump more money into public education while poor districts fall further behind.

Emanuel thanked the governor, a personal friend who has turned into a political adversary, saying “today we’re choosing the students over a failed status quo.”

“Its a historic moment because we’re finally fixing a historic wrong,” the mayor said.

Republican House Leader Jim Durkin also sounded a positive note after more than two years of gridlock in Springfield, saying: “I think this is the start of something that we can do more often.”

Cullerton took a dig at Rauner’s evolving stance on the measure, promising to keep his own remarks short.

“I don’t want to say anything to change the governor’s mind,” Cullerton.

Notably absent was House Speaker Mike Madigan, Rauner’s chief political nemesis, who issued a statement hailing the bill as “a victory for our schools, our students and our communities.”

“It’s also a victory for compromise that I hope we continue to build on,” the Southwest Side Democrat said. “By working together and in good faith, even when we do not totally agree, Democrats and Republicans have created a plan where every school district wins.”

The governor included Madigan’s remarks in a news release his office issued after the bill signing.

The signing at Ebinger Elementary School in Edison Park caps a tumultuous summer in which legislators left Springfield in July without an agreement in place on how to fund schools. House Democrats had pushed for a Senate Democratic measure, but the governor vetoed it on Aug. 1.

RELATED: Cardinal Cupich says he taught Rauner, Madigan to ‘trust each other’

Emanuel says property tax hike needed to avoid CPS ‘train wreck’

An agreement was reached last week among Democratic and Republican legislative leaders and the governor. Included in the deal is language that would authorize the Chicago Board of Education to impose a property-tax hike worth $125 million without any involvement from the Chicago City Council. The Board of Education plans to approve the increase, enabling the Chicago Public Schools to get $450 million in new state and local money for the 2017-18 school year.

Schools could see their money within days, according to the state comptroller.

This year, CPS will get an extra $76 million under the revamped formula. Illinois will also pay CPS $31 million for grants, including for early childhood education, and $221 million towards CPS’ normal pension costs.

Rauner had called the initial Democratic measure a “Chicago bailout,” but the bill he signed into law ends up giving CPS even more. Rauner and Republicans, however, were able to agree to a number of items within the “compromise,” including a private school scholarship and tax program heralded by Cardinal Blase Cupich but opposed by powerful teacher unions, including the Chicago Teachers Union and the Illinois Federation of Teachers, that traditionally have supported Democrats. It would provide tax credits for anyone who donates to organizations that would create scholarship funds for low- and mid-income students attending private schools.

At least for the next five years — when the measure will sunset — donors will get a credit for 75 cents on every dollar they give. Democrats estimated the program would provide scholarships for up to 6,000 students

The measure also allows for property tax relief through referendums and includes mandate relief for districts.

Hours before Rauner signed the hard-fought school funding compromise that provides the $450 million windfall for CPS, Emanuel refused to say how large a hole remains or how the city plans to fill it.

The mayor said he signed off on yet another massive property tax increase for teacher pensions to avoid a “train wreck” at the Chicago Public Schools after years of pension neglect.

On Thursday the amount CPS has to come up appeared to grow bigger thanks to a little-publicized provision in the hastily-filed 550-page bill that benefits Illinois’ publicly-funded, privately-managed charter schools.

“Nobody takes lightly the property tax increase of $83-a-year [on a home valued at $200,000],” Emanuel said before the bill signing. “On the other hand, the cause of it is the state of Illinois has never contributed to teachers pensions. There was a hiatus for about a decade where the city never participated. And since 1983, teachers basically took a hiatus. That’s what created the crisis,” Emanuel said.

“Now all parties are part of actually averting that train wreck and doing what’s necessary.”

Contributing: Fran Spielman