TORONTO -- William Nylander's contract impasse has finally come to an end.

The restricted free agent signed a six-year extension with the Toronto Maple Leafs on Saturday, just before the deadline of 5 p.m. ET. The agreement carries an average annual value of US$10.2 million this season and $6.9 million from years two through six.

Nylander, who was selected eighth overall by the Leafs in the 2014 draft, had to sign a contract by Saturday's deadline in order to be eligible to play in the NHL this season.

"I'm happy for our team. I'm happy for William," Leafs general manager Kyle Dubas said before the team's 5-3 road win over the Minnesota Wild on Saturday. "I wish that we were able to get this done before training camp and he was able to be a part of this.

"I think the team's record right now is a testament to the coaching staff and to the players on the group, especially that they haven't really allowed this to become a distraction ... They've had a great start to the season and I've learned a lot about the coaches and the players and their ability to (stay focused). I'm very thankful for them that they were able to perform the way they had. I'm excited now to add William to the group. He's going to make us better."

Nylander and the club had been at odds on the terms of a new agreement after his entry-level contract expired July 1, with negotiations stretching through the summer, into training camp and ultimately forcing the 22-year-old winger to miss 26 games this season.

There were reports Nylander, who remained in Europe during talks between his representatives and Dubas, was initially asking for $8 million per season on a long-term deal, with Toronto believed to have been countering with an offer in a $6-million range annually.

"Going home," Nylander posted to Twitter along with a picture of his Leafs' hockey bag about 30 minutes after the contract was announced.

The son of former NHLer Michael Nylander was the first of Toronto's young star forwards -- Auston Matthews and Mitch Marner are the others -- to hit restricted free agency.

"I think at the end it becomes a little bit frantic when you go right down to the deadline at the very end and you're trying to make sure everything gets in," Dubas said. "The worst-case scenario would have been a technical glitch that prevented this in going past the 5 o'clock deadline. No real emotion. Just stuck to our process and worked together with (Nylander's agent) Lewis Gross and William to complete it just under the wire."

Leafs head coach Mike Babcock remained confident throughout negotiations that Nylander would eventually return to the fold.

"Kyle (Dubas) and (assistant GM Brandon Pridham) and the guys did a real good job in getting that done," Babcock said after a 5-3 win over the Wild. "I know I wouldn't have the patience for that kind of thing myself, so it's good they were able to do it. Willy was ecstatic after. He wants to be back here and we want him back here. It'll take us four or five days to get him in the lineup, but as soon as we can we'll get him in."

Nylander is coming off back-to-back 61-point seasons, including a 2017-18 campaign that saw him score 20 goals and add 41 assists. He had 49 points at even strength, with a team-high 34 assists.

The Calgary-born Swede has 48 goals and 87 assists for 135 points in 185 career games. Nylander has added two goals and six assists in 13 playoff outings.

When asked if he ever thought the deal was not going to happen, Dubas said, "It's tough to say. I think we always tried to stay optimistic and have faith that our offers were fair and that they were coming from a good place as well and that, in the end, him missing a full season and having it go across 5 o'clock today wouldn't have been good for anybody. Not for the team, not for William.

"You always kind of maintain that faith. If it gets closer to the deadline, you start to maybe doubt it a little bit. But in the end, we're happy that it did end with him signing, for sure."

After the Leafs lured centre John Tavares to Toronto with a seven-year, $77-million contract in free agency this summer, Babcock mused about a top line of Nylander, Matthews and veteran winger Patrick Marleau.

But Kasperi Kapanen, one of Nylander's good friends, occupied the right side on that unit for most of the early part of the schedule until Matthews suffered a left shoulder injury on Oct. 27 that ruled him out of action for 14 games.

Matthews returned to the lineup Wednesday, scoring twice and adding an assist in a 5-3 victory over the San Jose Sharks.

Toronto, a popular pre-season pick to hoist the Stanley Cup this spring thanks in large part to its explosive offensive talent up front, had a record of 18-8-0 heading into Saturday's game against Minnesota and was third in the overall standings.

Matthews and Marner, a pair of 21 year olds whose entry-level contracts are set to expire next summer, have said they're talking with the Leafs about new deals.

Matthews could be looking for something in the neighbourhood of the $12.5 million per year Edmonton superstar Connor McDavid takes home, while Marner's ballpark might land somewhere in the $10-million range of Buffalo captain Jack Eichel.