School reform advocates and representatives of the teacher unions sat next to each other Tuesday as Gov. Dannel P. Malloy signed a law that they all believe to be a step toward eliminating the worst-in-the-nation achievement gap.

Flanked by lawmakers and school children and facing a room full of municipal officials and school superintendents, Malloy acknowledged that the bill was hotly debated. It was the topic of discussion for months as lawmakers and administration officials seemed to go around and around on the issue of charter schools and collective bargaining.

But an 11th-hour negotiating session led to an agreement that was passed 28-7 by the Senate and 149-0 by the House the day before the end of the legislative session.

Malloy administration Chief of Staff Mark Ojakian said there was a point two weeks ago where the two sides thought they weren’t going to be able to get their opposing viewpoints back to the bargaining table, but they did.

Ojakian, who negotiated the $1.6 billion agreement with the state employee unions last year, said they had a similar incident during those negotiations where things almost “blew up” and they were able to come back together. Ojakian was responsible for getting the two sides back to the bargaining table this year as well.

He said he remained optimistic as negotiations dragged into the early morning hours the weekend before the end of the legislative session. He said he knew they’d be able to get it done as long as everyone took a deep breath and realized the importance of getting the bill passed or, conversely, the consequences of what would happen if they didn’t reach an agreement.

Based on the smiling faces in attendance at the bill-signing ceremony Tuesday, they may have done it in a way that allows both sides of the issue to claim victory.

Steve Simmons, vice chairman of the Connecticut Council for Education Reform, praised the increases in preschool slots and funding for charter school students, the creation of a chart of common accounts for local school districts, and teacher “tenure that’s tied to effectiveness.”

Simmons said even though the new evaluation system being developed by the state’s Performance Evaluation Advisory Committee won’t be tied to a teacher’s salary or certification, it will mean something.

“To get tenure and retain tenure you have to an effective teacher,” Simmons said. “It’s really the end of tenure as we know it in the state.”

The tenure issue and how Malloy framed the debate over tenure caused a backlash from the state’s two teacher unions, who actively lobbied against the original bill.

Malloy’s original bill, which was changed by the legislature through the negotiations, would have required teachers to re-earn their tenure every five years based on evaluations tied largely to student achievement. Under the new law, new teachers would get tenure after three years if they earn two “exemplary” evaluations and after five years with three “proficient” or “exemplary” evaluations.

A teacher will be required to earn an “effective” evaluation to earn tenure after their first four years of teaching and in order to lose it they will have to receive an “ineffective” rating, but neither will be tied to certification or pay.

Phil Apruzzese, president of the Connecticut Education Association, the state’s largest teachers union, said that “all of the nonsense about tenure and its effectiveness will go away” if the state can implement a good process through the Performance Evaluation Advisory Council.

“I think the great lesson here is that if we collaborate, good things can actually get done,” Apruzzese said. “I hope it was a message to the governor as well that through collaboration we got a bill that we all can live with.”

Going forward “we’re all going to have to be in the same room together to come up with a good end product for our kids,” Apruzzese said.

Asked if this legislation emboldens the private school movement, Apruzzese said charter schools have been in Connecticut for a long time now.

“They’re a part of the public school system,” he added. “It’s just that so many people get hung up on the fact that some companies come in and they’re for-profit and we have a problem with that.”

The legislation only allows nonprofit education organizations to reconstitute low-performing public schools.