The New York Rangers traded captain Ryan McDonagh and forward J.T. Miller to the Tampa Bay Lightning for Vladimir Namestnikov, two prospects and two draft picks just before Monday’s trade deadline.

The prospects are Libor Hajek and Brett Howden. The Rangers also acquired Tampa Bay’s first-round pick in 2018 and a conditional first-round pick in 2019.

New York has three first-round picks in June’s draft. The Rangers also have two second-round picks, two third-round picks, a fourth, a fifth and a sixth for a total of 10 picks.

The deal continued the Rangers’ rebuilding process. They have acquired defenseman Rob O’Gara and a 2018 third-round draft pick from Boston for Nick Holden; prospect Yegor Rykov and a 2018 second-round draft pick from New Jersey for Michael Grabner; a 2018 first-round pick, a 2019 seventh-round pick, prospect Ryan Lindgren, Ryan Spooner and Matt Beleskey from Boston for Rick Nash; and now Namestnikov, Hajek and Howden.

“You look at these opportunities when they come along and maybe we take advantage or get an opportunity because teams feel they can win and we can make these deals,” Rangers general manager Jeff Gorton said.

As the Rangers head to Western Canada for a three-game road trip against Vancouver, Calgary and Edmonton, they are 25th in the NHL with a 27-30-6 record and 60 points.

Whereas New York is looking toward the organization’s future, Tampa Bay is bolstering its roster in an attempt to win the franchise’s second Stanley Cup.

In acquiring McDonagh, the Lightning are acquiring a top-pairing defenseman who has one year left on a six-year, $28.2 million contract signed prior to the 2013-14 season. He joins a defensive group which includes Victor Hedman, rookie Mikhail Sergachev, and McDonagh’s former teammates in New York, Dan Girardi and Anton Stralman.

Right wing Ryan Callahan, who also played with McDonagh with the Rangers from 2010 to 2014, is also a member of a Lightning team which leads the Eastern Conference with 87 points entering Monday night.

McDonagh has 26 points (two goals and 24 assists) in 49 games this season, and 238 points (51 goals and 187 assists) in 516 regular-season games. He has 10 goals and 31 assists in 96 playoff games.