If it wasn't for winter's frigid temperatures, basketball might never have been invented.

Love basketball? Then you should be grateful for the freezing cold winter.

If it weren’t for sub-zero temperatures—the kind of weather NBA stars, tourists and media can’t stop talking about during their visit to Toronto this All-Star weekend, where the thermometer at one point dipped to -26° C—the sport may never have existed.

“Yes, it’s a bit cold here, but I’ve been reading up on Dr. James Naismith, who, of course, was born in this very province of Ontario,” says NBA commissioner Adam Silver. “When he founded this game 125 years ago, it was because he thought there was an activity needed to keep young men active on these very cold winter days. Of course, he planned it as an indoor activity.”

Basketball wasn’t Naismith’s first choice. While teaching physical education at the International YMCA Training School (now Springfield College) in Massachusetts during a harsh 1891 winter, he tried activities like gymnastics and calisthenics on his group of restless college students, but they didn’t satisfy the young men’s desire for competition.

“They were getting bored because they were used to playing football, baseball and track,” says Rob Rains, author of James Naismith: The Man Who Invented Basketball, which he co-wrote with Naismith’s granddaughter Hellen Carpenter. “[Naismith] said we have to come up with some kind of a game that will keep them busy and physically fit—which was his primary focus.” For that, he needed an indoor sport that provided a competitive atmosphere.

More from macleans.ca: One small patch makes history on NBA All-Star weekend

Naismith tried modifying rules of several outdoor sports—football, soccer and lacrosse—but they were all too rough and dangerous indoors, Rains says. “So he thought back and there was a game that he played growing up in Canada, which he called ‘Duck on the Rock.’ ” A game for children, it involved throwing rocks at a larger stone—the duck—which sat on some sort of ledge. It was target practice, essentially, and something Naismith could adapt for indoor play.

In the gymnasium, Naismith needed some kind of a target for throwing an old soccer ball and asked the custodian if he could help. It was wintertime; the custodian had some peach baskets sitting in storage.

They connected the baskets to the gym’s overhead track, which just so happened to be 10 feet high—the same height that NBA superstars were dunking basketballs this weekend in Toronto, indoors and safe from the Canadian cold.

More from Aaron Hutchins: Inside the NBA’s shoe culture

With the NBA All-Star game taking place for the first time outside the U.S., and fewer than 400 km from Naismith’s hometown of Almonte, Ont., many fans and all-stars alike are finally experiencing the type of weather that provided the spark to invent the sport—though they likely don’t think of it that way.

Buenos días desde #Toronto! Hoy hace calorcito por aquí ❄️

Good morning from Toronto! Nice and warm over here! ⛄️ pic.twitter.com/tskZhYQr88 — Pau Gasol (@paugasol) February 13, 2016

“It’s been a great winter. Until these last couple days,” says Toronto Raptors all-star guard DeMar DeRozan. “But nobody seems to believe me.” One might wonder if the bitter cold weekend dissuades any star players from one day signing with the Raptors team, opting instead for a warmer climate.

Commissioner Silver says each time he hears someone talk about the cold, he reminds them that while that may be true, that’s exactly why the professional game takes place inside. When discussing the prospect of future all-star games once again taking place outside the U.S., one journalist asked Silver if it would be some place warm next time.

“Like I said, we love it here in Toronto,” the NBA commissioner responded. “The game is indoors. Stop complaining.”