TAIPEI, Taiwan — Taiwanese voters demonstrated their overwhelming desire to distance themselves from China and to reject its proposal of living under a Hong Kong-style "one country, two systems" arrangement, returning both the presidency and the legislature to the independence-leaning Democratic Progressive Party.

President Tsai Ing-wen won a resounding reelection, taking 57 percent of the vote — and earning a record 8 million votes — in a three-way race, according to the Central Election Commission. Her party also retains control of the Legislative Yuan, enabling her to press ahead with her reform agenda and cater to the generation of Taiwanese who say they were "born independent."

The strength of Tsai's victory particularly underscores Taiwanese voters' antipathy toward China and the Communist Party's designs on absorbing the self-ruled island of 23 million people.

"The results of this election carry an added significance," a characteristically restrained Tsai told reporters here after her landslide win. "They have shown that when our sovereignty is threatened, the Taiwanese people will shout our determination even more loudly back."

Indeed, the outcome is a stinging rebuke to the Communist Party and its leader, Xi Jinping, who has refused to rule out trying to take control of Taiwan by force. It will probably lead to greater aggression from Beijing.

China is always an issue in Taiwanese elections, but it has been particularly prominent this time around because of the events in Hong Kong over the past six months.

Hong Kongers, who are supposed to enjoy a degree of autonomy under a "one country, two systems" framework that was agreed to when the territory returned to Chinese control in 1997, have been protesting relentlessly against Beijing's increasing erosion of their freedoms, to no avail.

Taiwan's vote could be the most consequential election of 2020, said Natasha Kassam, a former Australian diplomat who is now with the Lowy Institute in Sydney.

“Not only is Taiwan a proxy for much of the world’s strategy to deal with the consequences of an increasingly authoritarian China, but also Taiwan has been on the front lines of the Chinese Communist Party’s aggression for decades,” she said. “And while it is trying to safeguard its democratic institutions, it’s also trying to manage its economic relations with China.”

This framework, though implemented in Hong Kong and Macao, was designed with Taiwan in mind. The Communist Party, especially under Xi’s leadership, harbors a dream of incorporating Taiwan into its People’s Republic, even though Taiwan has never been a part of that state.

Technically, it has existed in a kind of limbo ever since the Communists took control of China and the nationalists from the Kuomintang (KMT) fled to the island, 100 miles off China’s southeast coast, in 1949.

But in reality, it has become a dynamic and pluralistic society, boasting the world’s first transgender cabinet minister and last year becoming the first in the region to legalize same-sex marriage, with its own sense of national identity.

Polls show that more than half of citizens identify only as “Taiwanese,” concentrated in the younger generations, while most of the remainder call themselves both Taiwanese and Chinese.

“This election was about national identity and sovereignty, so it reflects the demographics of Taiwan,” said Nathan Batto, a researcher at the Academia Sinica think tank in Taipei.

Throughout the campaign, Tsai has held up the events in Hong Kong as a harbinger of what would happen to Taiwan if it were to agree to such an arrangement, mobilizing the electorate with the warning: “Hong Kong today, Taiwan tomorrow.”

“We reject the ‘one country, two systems’ proposed by Xi Jinping,” Tsai told reporters Saturday night before heading to a huge celebration rally in central Taipei. “We value the lifestyle of democracy, and we defend our sovereignty.”

Han Kuo-yu, the candidate for the Beijing-friendly KMT, who ran a Trump-style campaign of angry populism, won 38.5 percent of the vote. “No matter what, we hope to see a united Taiwan when we wake up tomorrow,” an emotional Han told his supporters at a rally in the southern city of Kaohsiung, where he is mayor.

The KMT, which has traditionally favored much closer ties with China, will have to reflect on its losses, Batto said. “They might have to ask themselves whether their strategy for dealing with China is still appropriate and whether they were right to select such a populist. They had issues in terms of substance and packaging.”

Even for the dynamic democracy that is Taiwan — complete with candidates in Japanese anime costume and a death-metal band frontman — this election was electrified.

That was partly because of the Hong Kong factor, but also because of clear signs that China was trying to spread fake news through social media and tilt the coverage in traditional media with strong ties to the mainland. The disinformation continued on election day, with messages circulating on social media telling people not to come out to vote because of the risk of a pneumonialike virus from China.

Chinese efforts to muddy the waters in Taiwan were credited with propelling the KMT to a huge victory in local elections at the end of 2018, with voters skewing older. But China’s efforts may have backfired spectacularly by encouraging people to vote — and not for the KMT.

Turnout was high, at almost 74 percent. Lines were so long that Tsai had to wait 20 minutes to vote at a Taipei elementary school, while her predecessor as president, Ma Ying-jeou, waited for 30 minutes. Local television showed one man driving his boat 60 miles from the city of Tainan to his polling station on the outlying island of Penghu.

And because there is no absentee voting in Taiwan, overseas Taiwanese returned in droves to cast ballots. The number of overseas Taiwanese who registered to vote Saturday was more than double the number in the 2016 elections.

The cautionary tale of Hong Kong encouraged many young Taiwanese to vote. “I don’t want Taiwan to become the next Hong Kong,” said Chen Yi-wen, a 28-year-old waitress in Taipei. “We have to use our votes to guarantee the democracy and freedom of our home.”

Some revelers held “We are not China” placards on the streets after the results came out Saturday night. Others chanted “Liberate Hong Kong, revolution of our time!” and flew the black “Hong Kong, revolution now” flags that are usually seen on the streets there.

“The result shows our resistance towards the mainland, because most of us didn’t choose the KMT,” said Cindy Lin, who took the day off work to vote for Tsai and attend Saturday night’s victory rally. “We stand with Hong Kong. I have never thought that I was Chinese.”

The big question now is how China reacts to Tsai’s victory and the continued dominance of the DPP.

Since Tsai’s election in 2016, Beijing has systematically sought to isolate and constrain Taiwan by peeling off its diplomatic partners — only 15 small countries now recognize Taiwan — and having it shut out of international institutions like the World Health Organization and climate talks. Taiwanese citizens on vacation in New York cannot even go on tours of the United Nations headquarters because the international body does not recognize their passports.

Beijing has also sought to hurt Taiwan economically, most recently banning Chinese tourists from traveling to the island independently, and has punished companies that have suggested Taiwan might be an independent country.

That strategy will probably continue, analysts say. Some wonder whether China will exclude Taiwan, which usually competes as “Chinese Taipei,” from the Winter Olympics it will host in Beijing in 2022.

In her remarks Saturday night, Tsai repeatedly emphasized her “commitment to peaceful, stable cross-strait relations” based on parity between the two sides and dialogue.

There was no immediate reaction from Beijing, but the Global Times newspaper, which often reflects the foreign policy thinking of the Communist Party, said Tsai’s reelection showed the need to “expedite reunification.”

Correction: This story has been updated to correct the description of the man’s boat journey. It was from the city of Tainan to the island of Penghu.

Tiffany Leung contributed to this report.