Basketball may have been invented by a Canadian and popularized by Americans, but it has more fans in China than anywhere else.

Courts can be found scattered all over the country, from a cave in Guizhou province to a rooftop in Shanghai. Even China's controversial man-made islands in the South China Sea have courts.

An estimated 300 million people play basketball in China, according to figures cited in Chinese state media. Many of them are fans of the NBA, whose future in the country could be in jeopardy thanks to a now-deleted tweet by Houston Rockets general manager Daryl Morey expressing support for anti-government protests in Hong Kong.

Those protests have significant support in Western democracies, but are seen by Beijing as destabilizing and dangerous. The demonstrations, now in their 18th week, have become increasingly violent, with protesters targeting Chinese businesses and banks, and burning the national flag.

Morey has since apologized, and the NBA issued a statement distancing itself from his tweet, saying his views "have deeply offended many of our friends and fans in China, which is regrettable."

Despite this however, a handful of Chinese businesses have already cut ties with the Rockets over the controversy, and broadcasters have said they will not show Rockets games in the country. On Tuesday, CCTV Sports said it was halting all broadcasts of pre-season NBA games in China, one of which is due to take place in Shanghai later this week, between the Brooklyn Nets and the LA Lakers.

The apparent rolling over for Beijing quickly sparked its own backlash. The NBA and its commissioner, Adam Silver have been heavily criticized for seemingly abandoning their progressive values to avoid endangering a lucrative market.

The NBA has spent years and many millions of dollars investing in China, helping build courts, giving broadcasting rights away for free and bringing its stars over for preseason games.

But basketball's roots run deep in China and are older than the NBA. The sport has been played there for more than a century -- it was first introduced by the YMCA in the 1890s, just years after it was invented by James Naismith in Springfield, Massachusetts. The father of Communist China, Mao Zedong, encouraged his followers to play the game.

Today -- as the Morey scandal shows no signs of flagging -- the country's fans are increasingly stuck between a rock and a hard place: abandon a league they love, or risk seeming unpatriotic.

Wen's world

As a man in his sixties who lacked muscle definition and hops, former Chinese Premier Wen Jiabao always looked somewhat out of place on the hardwood.

But it never stopped him from hooping and encouraging others to do so.

Wen was part of a government that saw China become both an economic powerhouse and a basketball-crazed nation.

Its no coincidence that they coincided -- with all that money coming in, the ruling Communist Party was concerned about the possibility of its citizens becoming lazy and lethargic.

Basketball was a logical investment. Courts are easy to build and the game is easy -- and cheap -- to pick up. Success is predicated on hard work and cooperation, key themes that the government wanted to encourage in children.

Since then, China has built more than 600,000 courts across the country, according to state media. The NBA announced in 2015 its spending another $1.6 million to help build and refurbish courts throughout the country.

That same year, the NBA agreed to a five-year deal with Tencent, giving the Chinese tech company digital broadcasting rights for a reported $500 million, though exact figures were never announced. Nearly 500 million people in China watched NBA programming on Tencent platforms during the last season, and the two sides recently signed a five-year extension of the partnership. Tencent was one of the companies that responded to Morey's tweet, saying it would suspend streaming for Rockets games.

Though Silver was commissioner when the ink was signed on the 2015 Tencent deal and has overseen an expansion of exhibition games in China, his predecessor, David Stern, is largely credited with laying the groundwork to securing the Chinese market.

Stern's investment

Stern led the league for 30 years, and in 1989 -- early in his tenure -- he secured a deal with Chinese broadcasters to air the games in the country before the other North American big four sports leagues.

He also presided over the league during key events that helped grow China's basketball craze.

Stern allowed NBA stars to play in the Olympics for the first time in 1992, and is now credited as one of the architects of the "Dream Team" that helped popularize the game globally. He led the negotiations that allowed Yao Ming to play in the NBA. Yao would go on to have a Hall of Fame career with the Rockets, making them the most popular team in China and making him arguably China's most recognizable celebrity internationally.

And Stern was in charge when the NBA founded NBA China, the massive affiliate that deals with the league's business in the country.

But the China David Stern dealt with was significantly different than the one Adam Silver faces.

Under President Xi Jinping, China has become more nationalist and patriotic. Companies that don't toe the line on hot button issues like the status of Taiwan, Tibet or Hong Kong have suffered serious consequences.

Many corporations have folded under the pressure. But the NBA enjoys a reputation as North America's most progressive sports league, and Silver himself encourages free speech among its players. These are the same athletes who travel to China in their off season on promotional tours, greeting hoards of adoring fans at every stop.

LeBron James, likely the world's most famous basketball player, has been perhaps the most vocal player on social and political issues. While playing for the Miami Heat in 2012, James participated in a team protest in the aftermath of the Trayvon Martin shooting; he endorsed Hillary Clinton in 2016 and has supported Colin Kaepernick in the former San Francisco 49ers quarterback's fight with the NFL -- a fight that has helped expose the huge social differences between the basketball and football leagues.

The Chinese fans lining up to see James may vehemently oppose the current anti-government protests in Hong Kong. The coverage of the political unrest shown on state television and online media is subject to heavy censorship by Beijing, ignoring the more peaceful elements and instead focusing on the violence.

The NBA's problem, in essence, stems from its growth, said Mark Dreyer, a Chinese sports analyst and journalist based in Beijing.

"They really do have a global league ... and as a result they have a very global fan base" Dreyer told CNN. "They have to legitimately cater to all sides of those fan bases."

Facing a further backlash in the US and Hong Kong over its statement meant to placate Chinese fans, it may be impossible for the NBA to thread the needle on this issue.

On Tuesday, major Chinese e-commerce companies Taobao and JD.com pulled Rockets merchandise from their stores.

In announcing it was dropping all pre-season games, Chinese broadcaster CCTV Sports took particular issue with Silver defending Morey's right to free speech in comments to Kyodo News while in Japan.

"We express our strong dissatisfaction and opposition to Silver's stated support of Morey's right to free speech," CCTV said in a statement. "We believe any remarks that challenge national sovereignty and social stability do not belong to the category of free speech."

If the NBA continues to stand behind Morey and respond to its domestic critics who accuse the league of selling out its values to retain its most valuable market, it puts Chinese fans in a tough spot.

They may be forced to choose between sports loyalty and patriotism, and there's no clear answer whether the NBA's massive popularity and cultural relevance will outweigh the nationalist fervor that's swept through China.

CNN's Steven Jiang contributed reporting from Beijing.