The Toronto Maple Leafs finally reached an agreement with star forward William Nylander, signing the 22-year-old RFA to a six-year contract extension.

Per Sportsnet's Elliotte Friedman, the deal will be slightly approx. $6.9 million on average per season.

The Maple Leafs managed to get a deal done just hours before the 5 p.m. EST deadline. Had Nylander not signed with the Maple Leafs, he would have been ineligible to play for the remainder of the 2018-19 season.

Speculation heated up that the Maple Leafs would trade Nylander if they couldn't close the deal. But first-year GM Kyle Dubas finishes up an impressive and busy offseason by getting one of his core players under contract.

Nylander was drafted eighth overall by the Maple Leafs in 2014. He has 48 goals and 135 career points in 185 NHL games. Nylander has scored 61 points in each of the last two seasons, helping the Maple Leafs qualify for the postseason.

The Maple Leafs had to be cautious with the Nylander extension, as Dubas signed All-Star John Tavares to a seven-year, $77 million deal in the offseason.

RELATED: BIGGEST NHL RUMORS THIS WEEK - DECEMBER 1, 2018

Credit: Tom Szczerbowski-USA TODAY Sports

With superstars Mitch Marner and Auston Matthews in line for extensions that will pay each of them over $10 million annually, it was crucial for Dubas to avoid paying Nylander too much money.

Toronto has been one of the best teams in the NHL this season, thanks to their high-scoring offence. With Nylander set to join Tavares, Matthews and Marner, things promise to get even better over the final three quarters of the season.

What This Means

It's a major win for the Leafs in getting Nylander signed long-term for a reasonable price. The latter also lands a contract that he feels is fair, so both sides are content and ready to move forward.

Now, the Maple Leafs have to hope that the Matthews and Marner contract negotiations won't drag this long into next season. But with Dubas showing his fine negotiating skills, Leaf fans have little to worry about.

NEXT: ERIK KARLSSON LEAVES MEDIA SCRUM SECONDS IN AFTER QUESTION ABOUT SENATORS