Major League Soccer and its players reached agreement in principle Wednesday on a collective bargaining agreement, a five-year pact that averted the first possible work stoppage in league history.

Two days before the 20th season will kick off, the sides overcame sizable differences in short order and came to terms during the fourth consecutive day of meetings at the Federal Mediation and Conciliation Service offices in Washington.

“We are pleased to finalize the framework for a new collective bargaining agreement with our players,” Commissioner Don Garber announced. “This agreement will provide a platform for our players, ownership and management to work together to help build Major League Soccer into one of the great soccer leagues in the world.”

Said Bob Foose, the Bethesda-based executive director of the players’ union: “We are pleased to finally turn our fans attention back to our players and the competition on the field as we get started on the 2015 season.”

Multiple sources confirmed the deal allows for the introduction of free agency but with conditions based on age and experience. It also raised minimum salaries and set guidelines for salary increases. Further details are expected to come out Thursday.

The deal clears the way for 10 matches this weekend, starting Friday with the reigning champion Los Angeles Galaxy hosting the Chicago Fire. In a sign of positive movement, the Fire flew to Los Angeles as scheduled Wednesday morning.

D.C. United’s CONCACAF Champions League match against Alajuelense proceeded as planned Wednesday night at RFK Stadium. United will open the regular season Saturday afternoon against the visiting Montreal Impact.

Dozens of players participated in talks over the past week, in New York and then Washington. Garber and several owners have also been involved. As of Tuesday night, the sides remained far apart on multiple key issues, most notably free agency, but worked into early Wednesday and returned later that morning.

On Wednesday afternoon, a source described it as “desperation but still talking.”

Representatives were holed up in the office building at 21st and K streets Northwest throughout the day, emerging for brief breaks. Some players had to leave the proceedings to rejoin their teams.

The previous CBA expired Jan. 31 but teams conducted training camp without a hitch.

The players were seeking some form of free agency; until this deal, clubs could hold the league rights to players in perpetuity, even after their contracts expired. An initial league offer of free agency for players age 32 and with 10 years’ experience was quickly rejected. Another proposal lowered the threshold to 28 years old and eight seasons; it’s widely believed the sides did agree to that guideline.

Other issues concerned the length of the CBA — the union would prefer a shorter deal in order to re-address issues in the near future — and the league’s salary structure. While a handful of big names make multi-millions, a large share of MLS’s work force earns less than $75,000.

MLS had adamantly fought free agency, citing the league’s centralized model — all players sign with the league, not individual teams, and have the same employer  – and the need to contain salaries under the founders’ slow-growth philosophy. However, the evolution of the league and the players’ firm stance seemed to soften the league’s approach and led to the limited form of free agency.