TORONTO — After one of the most-watched courtships in NHL history, the Toronto Maple Leafs got the news they were hoping for Sunday.

John Tavares is coming home.

The centre signed with the Leafs as free agency opened, bringing an end to a saga that gripped hockey for the better part of seven days, and ramped up even further during the final 48 hours.

The deal is worth US$77 million over seven years, with an average annual value of $11 million against the salary cap.

Tavares, from nearby Mississauga, Ont., tweeted that he was going to Toronto just after 1 p.m. ET and then added a photo of himself sleeping on Maple Leafs sheets as a child.

The club made the official announcement in a release moments later.

"I’m thrilled to be starting a new chapter of my career and life in Toronto," the Tavares tweet read. "I feel very fortunate to come join a team with a great young core and play where I grew up learning and loving the game. I can’t wait to get started!"

Tavares, who leaves the New York Islanders after nine seasons, met with his now-former club, the Leafs, San Jose Sharks, Boston Bruins, Tampa Bay Lightning and Dallas Stars this week as the six franchises on his preferred list made their pitches for the 27-year-old’s services.

Tavares had until 12 a.m. ET on Sunday to ink a contract extension that included an eighth season with the Islanders. But after that deadline passed without an agreement, it seemed certain New York was out of the running with only seven-year terms available.

The end result was Leafs rookie general manager Kyle Dubas getting by far the most prized free agent on the market, two summers removed from the franchise missing out on Steven Stamkos when the Lightning centre and native of Markham, Ont., decided to stick with Tampa Bay.

Tavares coming to Toronto is the biggest free-agent signing in Leafs’ history — eclipsing the addition of Gary Roberts and Shayne Corson in 2000 — and the biggest in the league since Scott Niedermayer left the New Jersey Devils for the Anaheim Ducks in 2005.

The first pick in the 2009 draft, Tavares has the fifth-most goals (272) and ninth-most points (621) in 669 games since entering the league. He had 37 goals and 47 assists in 82 games for New York last season.

While the deal is an earth-shaking coup for the Leafs, it also doesn’t come cheap and could present a cap squeeze in the near future with young stars Auston Matthews, Mitch Marner and William Nylander — a restricted free agent as of Sunday — all due big raises.

The club now owns an impressive 1-2-3 punch down the middle with Matthews, Tavares and Nazem Kadri, and solid goaltending in the person of Frederick Andersen, but Toronto still probably needs more help on defence to truly be considered a Stanley Cup contender.

Matthews and Kadri both welcomed Tavares via Twitter shortly after the deal was announced.

"Welcome aboard â†•91Tavares! Pumped to have you in the blue and white and now call you a teammate," Matthews said in his tweet.

"Welcome â†•91Tavares now we go to work," read Kadri’s tweet.

Kadri added a follow-up tweet featuring a picture of himself and Tavares sitting on the bench together from 2009 when they were teammates in junior with the Ontario Hockey League’s London Knights.

Toronto made the playoffs the last two seasons, but lost in the first round both times.

The Leafs also waved goodbye Sunday to winger James van Riemsdyk, who signed a seven-year contract reportedly worth $35 million with the Philadelphia Flyers, and centre Tyler Bozak, who signed on with the St. Louis Blues for three years at $5 million per season.

The Islanders made the playoffs just three times during the nine years Tavares spent in New York, winning a solitary round. But despite those spring disappointments, he did his part by putting up 11 goals and 11 assists in 24 career playoffs games.

Tavares signed a six-year, $33-million contract with the Islanders in September 2011 after completing his entry-level deal.

"The Island has been home, it’s what I know, it’s part of me — it always will be. I can’t thank you all enough for the dedication you have all shown," Tavares said in a separate tweet announcing his decision. "I’m sorry if this decision pains you, as you can tell it wasn’t easy, but have trust in the future because it is bright. The Islanders are in great hands."

While getting Tavares is a massive win both on and off the ice for Toronto, it’s a disaster for New York. The Islanders hired former Leafs general manager Lou Lamoriello in May to be their GM before wooing Barry Trotz — less than two weeks removed from winning the Stanley Cup with the Washington Capitals — as head coach with an eye towards keeping their captain.

It turned out in the end to not be enough.

New York has good young pieces in Calder Trophy winner Mathew Barzal and Anthony Beauvillier up front to go along with what was viewed by many as the one of the best drafts of 2018 after nabbing Oliver Wahlstrom and Noah Dobson, but still looks to be a long way off from contending after finishing last in goals against and shots allowed in 2017-18.

Tavares won back-to-back world junior hockey titles for Canada at the 2008 and 2009, and added an Olympic gold at Sochi 2014, but suffered a knee injury in the quarterfinals that forced him to miss the rest of the tournament and the balance of the NHL season.

He also helped Canada win the World Cup of Hockey in Toronto in 2016.