The St. Louis Cardinals agreed to terms with Lance Lynn on a three-year, $22 million contract on Thursday, avoiding arbitration in the process.

The deal buys out his remaining three years of arbitration eligibility. Cardinals general manager John Mozeliak admitted in the wake of the agreement that a long-term deal, which would have eaten some of Lynn’s first few years of free agency, was discussed but never really close.

It was rumored that Lynn would have earned between $5 million and $6 million through arbitration, which would have been a record for a first-time arbitration-eligible pitcher. The right-hander will make $7 million this season and $7.5 million in each of the following two seasons, according to a report. There are bonuses in the contract that could push the total value to $23.5 million.

The 27-year-old enjoyed a breakout season in 2014, posting a 2.74 ERA, 1.262 WHIP and 2.5 K/BB ratio in 203.2 innings (33 starts). He ranked ninth among National League pitchers in both ERA and strikeouts.

He was second among St. Louis pitchers in WAR (3.7), trailing only Adam Wainwright. Having traded Shelby Miller to the Atlanta Braves for Jason Heyward, the Cardinals need Lynn to be the glue that holds the rotation together behind Wainwright. There are also injury concerns surrounding Wainwright, only adding to Lynn’s importance.

Lynn may have eventually earned more through arbitration than he will under this deal, which is part of the allure for the Cardinals -- even though he was slated to be a member of the team through 2017 under arbitration rules. A longer deal through the first year or two of his free agency would have been more team-friendly deal (especially at around $7 million annually), but this pact could still become a bargain if Lynn continues to trend upward.

Grade for Cardinals: C-

Signing players to contracts through their arbitration years is in vogue, but these deals fall short when potential stars are still allowed to hit free agency. If Lynn pitches even at 2014 levels over the next three seasons, he’ll earn far more than $7 million annually when he becomes a free agent in 2017.

Lynn, who will be 30 when he hits the open market, has a reputation as an inconsistent pitcher, but that has often been overstated. He’s been an average to slightly above average contributor since making his Major League debut on June 2, 2011. While it’s true that he can put up a stinker from time-to-time, the Indianapolis native has the following career numbers: 3.46 ERA, 1.282 WHIP and 2.68 K/BB ratio.

His strikeouts were down this past season, but Lynn fared better against left-handed batters, which helped his overall numbers. Left-handed hitters had a .244/.325/.372 slash line against Lynn with 65 strikeouts and 39 walks in 2014, after posting a .259/.361/.404 line with 71 Ks and 49 BBs the previous season.

The keys to Lynn’s 2014 season were his numbers against lefties and a lower strikeout rate. He had 17 fewer strikeouts despite throwing two more innings than he did in 2013. Typically, pitchers rely less on power and more on finesse as they age and doing so a few years shy of 30 is a great sign for Lynn in terms of future success.

Grade for Lynn: A-

Lynn benefits more from this deal than the Cardinals in a variety of ways. If he flames out, his salaries for the 2016 and 2017 season are already guaranteed at more than $7 million. If he continues to pitch well, or even takes a step forward, he’ll hit the free agent market at an ideal time.