Image copyright Getty Images Image caption Tsai Ing-wen has told China to abandon its threat of force

Taiwan's President Tsai Ing-wen has secured a second term after sweeping to victory in an election dominated by the island's relationship with China.

Ms Tsai secured just over 57% of the ballot - a record 8.2m votes - well ahead of her rival Han Kuo-yu.

Ms Tsai opposes closer ties with China, with Mr Han suggesting they would bring economic benefits.

In her victory speech, Ms Tsai told China to abandon its threat to take back the island by force.

Ms Tsai told a news conference: "Taiwan is showing the world how much we cherish our free democratic way of life and how much we cherish our nation."

China has claimed sovereignty over Taiwan since the end of the Chinese civil war in 1949. It says Taiwan must eventually be reunited with China, by force if necessary.

Ms Tsai said China should now drop that threat.

"Peace means that China must abandon threats of force against Taiwan," she said in the capital Taipei.

"I also hope that the Beijing authorities understand that democratic Taiwan, and our democratically elected government, will not concede to threats and intimidation."

Did China get it wrong?

Eight million votes is an extraordinary tally for a Taiwanese President seeking a second term.

The record-breaking win has delivered a landslide mandate to Ms Tsai, and a major snub to Beijing.

It was the emergence of Taiwan's relationship with China as the central issue in this campaign that allowed her to revive her flagging fortunes.

And in her victory there is a certain political irony.

Beijing's rigid, authoritarian vision of a Greater China, united on its terms, has been wholeheartedly rejected in the one place actually given the opportunity to vote on the concept.

And had the Communist Party not turned up the pressure on Taiwan, had its approach to the crisis in Hong Kong been subtler, the path to victory for a candidate it wanted so much to thwart may have been much less certain.

After the result was announced I asked Tsai Ing-wen whether she had the Chinese President Xi Jinping to thank for her victory.

She smiled.

The US hailed President Tsai's victory as a demonstration of Taiwan's "robust democratic system".

"Under her leadership we hope Taiwan will continue to serve as a shining example for countries that strive for democracy, prosperity and a better path for their people," the US State Department said.

Mr Han, the Kuomintang party candidate, had earlier admitted defeat as the results became clear.

"I have called President Tsai to congratulate her. She has a new mandate for the next four years," he told a crowd in the southern city of Kaohsiung.

Image copyright Getty Images Image caption Han Kuo-yo had favoured closer ties with China

Ahead of the vote, Ms Tsai was leading in the polls as voters watched the way in which Beijing handled pro-democracy protests in Hong Kong.

Her stance was popular with those who fear Taiwan being overtaken by mainland China. In the final count she secured 1.3m more votes than in her 2016 victory.

President Tsai insists Taiwan's future should be decided by its 23 million people.

Voters were also choosing the next members of the Taiwanese legislature, where Ms Tsai's Democratic Progressive Party (DPP) has had a majority.

Image copyright Getty Images Image caption Supporters of Han Kuo-yu were devastated by the result

Image copyright Getty Images Image caption Those who backed Tsai Ing-wen, however, were jubilant

What is Taiwan's status?

For practical purposes, Taiwan is an independent state - it has its own elected government, constitution and military.

But China refuses to have diplomatic relations with any country that recognises Taiwan as a sovereign nation.

All but a handful of countries have picked Beijing, but most maintain an ambiguous relationship with Taiwan through trade. The US is also legally bound to supply Taiwan with the means to defend itself.

Where did the candidates stand on China?

Media playback is unsupported on your device Media caption China and its influence is a key issue in Taiwan's election

Ms Tsai wants to "maintain the existing mechanisms", according to her website - meaning she does not want to compromise Taiwan's de facto independence.

In a speech on the Hong Kong protests in June, she said "anyone who tries to undermine Taiwan's sovereignty and democracy, or use them as political bargaining chips, will fail".

She had also rejected Taiwan ever operating under the "one country, two systems" political system used in Hong Kong since it returned to China in 1997 - calling it "not viable".

Speaking to the BBC this week, she said Taiwan should "learn a lesson" from Hong Kong: "If we don't insist [on maintaining Taiwan's independence], we'll be losing everything we have now."

Mr Han and his party the Kuomintang (KMT) favour closer ties with China - which they say will bring economic growth - but do not seek unification.

The KMT once ruled China, before fleeing to Taiwan in 1949 after losing to the communist forces in the civil war.

Mr Han made a high-profile visit to Hong Kong and China in March, and has reportedly said a formal declaration of Taiwanese independence would be "scarier than syphilis".

What were the other issues?

Media playback is unsupported on your device Media caption Three couples and a wedding to celebrate Taiwan marriage equality

Although the economy has grown during Ms Tsai's presidency, exports have fallen and wage growth is sluggish.

Saturday's presidential election was also the first since Taiwan became the first place in Asia to legalise same-sex marriage.

The move was rejected in a series of referendums, but parliament passed a special law in order to comply with an earlier court ruling.

Ms Tsai said it was "a big step towards true equality".