A strike by Chicago schoolteachers that left most Chicago public schools shuttered for seven days ended late Tuesday afternoon after 800 union delegates voted to sign off on a negotiated three-year contract that Mayor Rahm Emanuel hailed as constituting “an honest compromise.”

The nearly 350,000 schoolchildren enrolled in Chicago’s schools will return to classes Wednesday.

The strike was the first in Chicago in 25 years. Chicago Teachers Union President Karen Lewis acknowledged that her side failed to receive “a perfect contract” but asked, in a press conference, “do we stay on strike forever until every little thing we want can be gotten?”

The settlement, which included teacher concessions on evaluations and seniority, prevents what would have been an ominous next step for the teachers union: court.

On Monday, after the union said it needed several more days to scrutinize the negotiated contract given to them over the weekend, Mayor Emanuel directed the Chicago Public Schools (CPS) system to file a complaint in the Circuit Court of Cook County saying the strike was illegal under Illinois state law because it was based on more than just wages and benefits.

Emanuel added a second reason for the strike’s illegality: It threatened public health safety. The complaint emphasized that the public schools were considered a haven for children in impoverished neighborhoods.

A Cook County judge had scheduled a hearing on the matter Wednesday if both sides failed to reach an agreement Tuesday.

In the end, the union conceded to two major reforms demanded by Emanuel since the beginning: a more rigorous system evaluating teachers and the ability of principals to hire or fire teachers based on performance and not necessarily seniority.

The new contract, which extends over three years with an option to renew a fourth, factors student growth in accounting for 25 percent of year-end teacher evaluations in years one and two and 30 percent in the third year. Student surveys will add to the evaluation starting in the second year.

Principals will continue as decisionmakers in hiring, but layoffs, for the first time in CPS history, will be determined by the level of teacher performance in the classroom, starting with those with the lowest evaluation ratings. Also for the first time, CPS will establish hiring practices that fast-track highly rated teachers who are laid-off because of school consolidations or closings for open positions at other schools in the system.

The CPS school day will also be extended: 75 minutes for elementary students and a half hour for high school students. The school year will be extended two weeks for all students.

The contract agreement provides teachers with a base salary raise of 3 percent in the first year and 2 percent in each of the next two years. If the contract is extended a fourth year, teachers would receive a 3 percent raise. Teachers are also eligible for raises for their years of experience and master’s degrees. The Chicago Public Schools says raises would be 17.6 percent on average over four years. Under past contracts, teachers received an automatic wage increase of 4 percent.

"In this contract, we gave our children a true seat at the table,” Emanuel said in a statement. “In past negotiations, taxpayers paid more but our kids got less. This time, our taxpayers are paying less and our kids are getting more," he said in a statement.

The teachers standoff became the first significant political fight of the Emanuel administration and it arrives at a politically sensitive time: one week after the Democratic Party convention in Charlotte, N.C., when Emanuel was tasked to lead a major fundraising effort to help President Obama win a second term.

Opponents depicted Emanuel as a Republican in disguise, a portrayal emboldened by the endorsement of Republican presidential nominee Mitt Romney, who denounced the teachers union and blamed Obama for putting not putting children first.

Emanuel positioned his side as fighting for the good of the children, but there was no doubt the city’s dwindling finances were also a factor.

The strike involved about 29,000 teachers and support staff in what is the nation’s third-largest school district. The 45,000 students enrolled in the city’s charter schools were not affected and remained in class throughout the seven days.