Second baseman Neil Walker informed the Mets just before a 5 p.m. deadline on Monday that he would accept a $17.2 million qualifying offer for 2017, a decision that keeps one of the team’s two most important free agents in Queens.

The other, the star outfielder Yoenis Cespedes, rejected the Mets’ qualifying offer, as expected, making him perhaps the most attractive free agent on the market.

Although Cespedes declined the offer, that does not preclude the Mets from continuing to pursue him. General Manager Sandy Alderson made clear last week at the annual general managers’ meetings in Scottsdale, Ariz., that the team was serious about re-signing Cespedes.

Alderson had also said the Mets wanted to keep Walker, 31, for next season — and beyond that, if possible. Walker, a switch-hitter, replaced Daniel Murphy at second base in 2016, hitting a team-leading .282 with an .823 on-base plus slugging percentage, second on the team only to Cespedes’s .884. Walker also hit 23 home runs and emerged as a clubhouse leader.

But his season ended early because he had surgery to repair a herniated disk in September. Although his prognosis was good, he has dealt with the injury for years, which could have made other teams leery of pursuing him.

Confident in Walker’s rehabilitation timeline, the Mets made the calculated risk of offering him the one-year qualifying offer. If Walker had rejected it and later signed with another team, the Mets would have received draft-pick compensation.

Despite being the top second baseman available in free agency, Walker would most likely have had limited options because of concerns about his back and the draft pick a team would have had to give up to sign him.

Walker is set to be the second-highest paid Met in 2017, after third baseman David Wright, who has a $20 million salary. Although the deal represents a large financial commitment to Walker, the risk is mitigated by the contract’s short length.

Keeping Walker will allow the Mets to use Jose Reyes as a third baseman — and perhaps a roving infielder — with Wright’s future clouded by his recovery from neck surgery and by his chronic back problems.

The Mets had long anticipated Cespedes’s decision. He had already exercised the opt-out clause in his contract, forfeiting two years and $47.5 million for an opportunity to earn more money via free agency. Cespedes, 31, hit .280 with a team-leading 31 home runs, so he should be able to get a large contract.

Alderson has been proactive in his regular talks with Cespedes’s agent, Brodie Van Wagenen. Alderson, who has often shied away from doling out large contracts to players in their 30s, said last week that the Mets had the financial means to pursue Cespedes.

Cespedes’s powerful bat helped carry the Mets to the World Series in 2015 and to an improbable wild-card berth in 2016. On a roster filled with left-handed-hitting outfielders, the right-handed Cespedes provided needed balance.

A version of this article appears in print on , Section B, Page 9 of the New York edition with the headline: Walker Takes One-Year Deal, but Cespedes Tells Mets No. Order Reprints | Today’s Paper | Subscribe