All-star Jordan Zimmermann will make $7.5 million next season and $16.5 million in 2015. (Jonathan Newton/THE WASHINGTON POST)

After making efforts this winter to lock up shortstop Ian Desmond and starter Jordan Zimmermann to lengthy contract extensions, the Washington Nationals on Friday settled on two-year deals for both, avoiding messy arbitration hearings with their homegrown stars who still will be able to test free agency after the 2015 season.

Zimmermann, the all-star right-hander, will make $24 million over two years — $7.5 million next season and $16.5 million in 2015. Desmond will make $17.5 million — $6.5 million next year and $11 million in 2015. Desmond also would receive a $500,000 bonus if he wins the National League most valuable player award , one check the Lerners would not mind cutting.

The Nationals had discussed long-term contracts with both players this winter, and the two-year deals signed Friday — the deadline before teams must exchange salary figures with arbitration-eligible players — do not preclude either player from signing a long-term deal before he reaches free agency.

“If a year down the road or after this season if there’s a long-term deal that works out for both sides, we’d be happy and willing to do it,” Zimmermann said. “This is just a small little deal that takes us away from the arbitration. Now I can focus on baseball and not have to worry about the other stuff.”

The sides had been “working on a long-term deal” this week, Zimmermann said but were “too far apart to get that done.” The Nationals presented the two-year option a few days ago, and Zimmermann’s agent, Mark Pieper, worked out the smaller deal.

“I’m definitely happy,” Zimmermann said. “This means I can just focus on playing baseball and trying to win a World Series.”

For much of January, the Nationals spoke with Desmond’s representatives about a one-year pact to avoid arbitration. In recent days, they broached a two-year deal. Earlier this winter, the sides talked about a longer deal.

“We have talked longer term,” said Doug Rogalski, who represents Desmond along with partners Ryan Gleichowski and Marc Pollack. “Obviously, we haven’t come to any agreement. Everything has been amicable.”

Desmond felt relieved to simply firm up his contract status. As Rogalski put the finishing touches on his deal today, Desmond was working out.

“I know the first thing he discussed afterwards was, now I just get to worry about baseball,” Rogalski said. “I think he feels like, ‘I don’t have to worry about this stuff. I can devote the rest of my offseason to baseball.’ ”

Two-year contracts have two benefits for the Nats. They give the team a controlled cost for two seasons, and back-loading the second year allowed the Nationals to save on their 2014 payroll. Zimmermann likely would have made $10 million this season on a one-year deal, and Desmond may have pushed close to $7 million. The Nationals, then, saved about $3 million in the short term.

Not locking up Desmond and Zimmermann, though, may cost them in the long run. 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 with a .333 on-base percentage and a .480 slugging percentage with 45 homers over the past two seasons.

Zimmermann made his first all-star team last year, and his 3.10 ERA since the start of 2012 ranks 17th in the majors. Clayton Kershaw’s seven-year, $215 million contract shows where the market for starting pitchers is headed.

The Nationals signed four other players to one-year contracts in order to avoid arbitration: reliever Drew Storen ($3.45 million, plus up to $1 million in incentives), starter Ross Detwiler ($3 million), catcher Wilson Ramos ($2.095 million) and reliever Jerry Blevins ($1.675 million).

The Nationals could not reach agreements with starter Doug Fister and reliever Tyler Clippard. Figures were exchanged and the sides have a month to reach an agreement before heading to an arbitration hearing.