Devin McCourty, Brian HartlineMIAMI — Coming off his best season, Brian Hartline wanted to stay put.

The veteran receiver agreed to a five-year deal for nearly $31 million to remain with the Miami Dolphins, his agent said Friday. The contract includes $12.5 million guaranteed, agent Drew Rosenhaus said.

Hartline would have become an unrestricted free agent Tuesday but decided instead to remain with the team that drafted him in 2009.

“I believe he could have signed for more in the open market with another team, but he wanted to remain with the Dolphins for less money,” Rosenhaus wrote in a text message to The Associated Press.

Hartline tweeted a photo of himself Friday signing the deal in the Dolphins’ offices.

“Officially put that name on the line,” he tweeted. “Blessed to be a Dolphin for 5 more years. Now it’s time to win some championships.”

Working with rookie quarterback Ryan Tannehill, Hartline led Miami last year with 74 receptions for 1,083 yards, both career highs, despite missing most of the preseason because of injuries.

However, he caught only one touchdown pass and has career totals of six scores in 183 receptions.

While Hartline is a solid No. 2 target, landing a top receiver for Tannehill remains the Dolphins’ foremost offseason priority, and they’re expected to court free agent Mike Wallace and possibly Greg Jennings. Miami’s wideouts combined for only three touchdown catches in 2012.

Hartline’s contact leaves the Dolphins with an estimated $33 million in salary cap space, giving them enough room to sign at least one major free agent.

The deal was the second significant move by the Dolphins this week. On Monday they designated defensive tackle Randy Starks as their franchise player.

General manager Jeff Ireland hopes to re-sign at least a couple of other players before they become free agents. Some players Miami may lose include tackle Jake Long, running back Reggie Bush, cornerback Sean Smith, safety Chris Clemons, tight end Anthony Fasano, backup quarterback Matt Moore and reserve tackle Nate Garner.