TORONTO -- The Ottawa Senators and Toronto Maple Leafs swapped underperforming defencemen a couple of hours before NHL free agency opened Monday.

The provincial rivals completed a deal that had been rumoured for about 48 hours, with Toronto trading Nikita Zaitsev to Ottawa for fellow blue-liner Cody Ceci.

The Senators also got forwards Connor Brown and Michael Carcone in the exchange, while the Leafs received defenceman Ben Harpur, centre Aaron Luchuk and a third-round pick that originally belonged to the Columbus Blue Jackets.

The trade is important for the Leafs because it gets Zaitsev's contract -- which carries an annual average value of US$4.5 million for the next five seasons -- off the books as the team facing a salary cap crunch looks to sign restricted free agent Mitch Marner and potentially add cheaper pieces to round out its roster.

Brown is scheduled to make $2.1 million in 2019-20 and is set to become an RFA next summer.

Zaitsev had requested a trade out of Toronto, but Leafs general manager Kyle Dubas said having to give up Brown was difficult.

"Just a wonderful person on and off the ice," Dubas said. "He's been an important part of turning this team around."

The salary cap for the coming season has been set at $81.5 million, down from an earlier projection of roughly $83 million.

Ottawa is at the opposite end of the spectrum from Toronto, needing to increase its wage bill to get to the cap floor of $62.2 million.

"We should thank Cody Ceci for his years in Ottawa," Senators GM Pierre Dorion told reporters at Canadian Tire Centre. "I know he got quite (a lot) of abuse, but he did everything we asked of him.

"We've very happy with the return that we got in the deal."

Dubas had hoped to get Marner -- the team's leading scorer with 94 points last season -- signed by July 1, but while he's now available to be tendered an offer sheet by the league's other 30 teams, Dubas remains optimistic.

"It's important to us that we find a way to get this done," he said during a press conference at Scotiabank Arena. "I know we set this as a priority and looked at today as a day we'd like to have it done by, and obviously we don't have that yet.

"But we'll keep working away trying to find a way to come to a good conclusion."

The Senators also dipped into the free-agent market Monday, signing veteran defenceman Ron Hainsey and winger Tyler Ennis, who were both with Toronto last season and now join former Leafs assistant and new Ottawa head coach D.J. Smith in the nation's capital

"Our goal is to make sure the Ottawa Senators are better and we feel we've done that today," Dorion said. "We're really comfortable with these decisions."

Zaitsev, who was due a $3-million signing bonus Monday, had to waive his limited no-movement clause for the trade to be completed.

The 27-year-old produced an impressive rookie campaign with the Leafs in 2015-16, registering four goals and 36 points in 82 games. But his play has fallen off drastically in the two seasons since with just eight goals and 27 points in 141 outings to go along with two assists in 18 playoff games.

Zaitsev signed a seven-year, $31.5-million contract with Toronto in the summer of 2016.

"Zaitsev does a lot of things that we're looking for," Dorion said. "We were 31st in goals against last year, I don't know where we were the year before, but we were really high. He's a strong defender, he's got great feet, he's ultra-competitive.

"When you look at 20-minute guys, not many are out there and we like the fact that we have him under contract for the next five years."

The Leafs, who also signed veteran centre Jason Spezza to a one-year deal worth $700,000 on Monday, managed to shed veteran winger Patrick Marleau and his $6.25-million salary when they traded him to the Carolina Hurricanes last month. Carolina bought Marleau out last week, making him an unrestricted free agent.

Much like Zaitsev, the 25-year-old Ceci was a lightning rod for criticism related to his poor performances with the Senators. The Ottawa native, who was drafted 15th overall in 2012, has 32 goals and 118 points in 440 career regular-season games, and has added three assists in 25 playoff contests.

An RFA with arbitration rights, Ceci was extended a qualifying offer by Ottawa last month. He made $4.3 million in 2018-19 and can become an UFA next summer.

Brown, 25, has 43 goals and 99 points in 253 career regular-season games to go along with five points (one goal, four assists) in 20 playoff contests. Selected in the sixth round of the 2012 draft by the Leafs, the Toronto native recorded a career-high 20 goals and 36 points in 2015-16 when played in a top-6 forward role.

"We'll miss him dearly," Dubas said of Brown. "It's an unfortunate part of this."