(John McDonnell/The Washington Post)

The Nationals signed shortstop Ian Desmond to a two-year contract for $17.5 million, a deal that buys out Desmond’s remaining arbitration-eligible seasons but will not prevent him from testing free agency after the 2015 season.

The Nationals handled Desmond’s contract the same as Jordan Zimmermann’s: They wanted to lock up their young star for years to come, but instead settled on a shorter deal in order to avoid an arbitration hearing both this year and next winter.

The Nationals’ deal today with Desmond will not preclude them from trying to sign him to a longer contract before he becomes eligible for free agency. But it suggests the sides must bridge a significant gap between now and next winter in order to keep Desmond from free agency.

Given the dearth of shortstops with Desmond’s offensive prowess, he would be a hugely valuable commodity on the free agent market. Desmond, a team leader in the clubhouse, has won consecutive Silver Slugger awards, hitting .286/.333/.480 with 45 homers over the past two seasons.