Image copyright Reuters Image caption Tsai Ing-wen has proven herself a shrewd politician

Taiwan's first female President Tsai Ing-wen is a thorn in mainland China's side and this may have worked to her advantage ahead of Saturday's general election.

When the island became the first Asian society to legalise gay marriage last year, Ms Tsai made global headlines, but was also criticised for going against majority public opinion in Taiwan.

Earlier, she faced accusations of nearly causing an electricity shortage with her promotion of green energy. When she tried to give all workers two days off a week, she found herself accused of hurting rather than increasing worker earnings and holiday.

Low wages and controversial pension reform also pulled down her approval ratings to as low as 15% late last year. She even had to battle a former subordinate for her party's nomination.

Media playback is unsupported on your device Media caption While many cheered, public opinion was against gay marriage

But her biggest headache has been China - it has turned up the pressure on her because she and her party do not accept that Taiwan can be part of one China.

Last year Beijing snatched seven of Taiwan's already sparse collection of diplomatic allies - only a handful of countries recognise self-governing Taiwan as a sovereign nation. China also displayed its muscle by flying fighter jets and sailing aircraft carriers in Taiwan's vicinity, and banned much-needed Chinese tourists from visiting the island.

Despite all this, as she stands for a second term, she has a good chance of winning.

The China question

The youngest of 11 children - her mother being the last of her father's four wives - Ms Tsai has proven herself to be a shrewd politician and a lot of this has been in her strategising on the sovereignty question that has dogged Taiwanese politics and identity.

Beijing sees the island and mainland China as a part of one country that must be unified one day. President Tsai insists Taiwan's future should be decided by its 23 million people.

When Chinese President Xi Jinping made a speech in January 2019 on the 40th anniversary of China's 1979 letter to Taiwan seeking to repair relations, she took the opportunity to drive home her point that Beijing is a threat to the island.

On the face of it, Mr Xi's speech was a reaffirmation of Beijing's goal of peaceful reunification under the One Country Two Systems principle.

This is the system under which Hong Kong has been governed since it was handed back to China in 1997 - in Hong Kong this meant that for 50 years a degree of autonomy and certain freedoms and privileges not seen in mainland China would remain protected.

But Ms Tsai used his speech as a chance to firmly reject an understanding called "The 1992 consensus".

This is the only agreement which - precisely because of its vagueness - has enabled both sides to glide over differences when it comes to Taiwan's sovereignty by agreeing that they are part of One China - and allowing space for each side to interpret that "One China" as they wish.

Taiwan's former ruling party defined it as the Republic of China, which is the island's official name. Ms Tsai insists, though, the phrase will only end up meaning whatever China wants it to.

But perhaps the most significant boost for President Tsai came from outside, in the months-long anti-China protests in Hong Kong, which she frequently used to emphasise the failure of One Country Two Systems.

It is significant because the principle has been floated as a model for eventual reunification with Taiwan.

Resisting Beijing's pressure

Ms Tsai's message has helped her approval ratings soar.

Beijing has also made it easy for her - by stepping up military, political and economic pressure. The turmoil in Hong Kong and China's policies in its Muslim-populated Xinjiang region have further worried Taiwanese people.

To Ms Tsai's supporters, especially people who favour Taiwan's formal independence, she is doing the right thing by not bowing to Beijing's pressure and accepting the 1992 Consensus, China's condition for good relations.

By accepting it, she would be linking Taiwan's future to mainland China. Her party favours formal independence for the island, which has been ruled separately since the end of the Chinese civil war in 1949.

Image copyright Reuters Image caption Ms Tsai's anti-Beijing stance has helped her approval ratings soar

To her critics, she is making relations with China unnecessarily tense, and threatening Taiwan's stability and prosperity.

They see the 1992 Consensus as the best solution so far; they don't believe accepting it would bind Taiwan to unifying with mainland China, seeing her rejection of it as a way to scare voters about China so they will vote for her and eventually push for formal independence - when polls show a majority of Taiwanese favour the status quo.

What about the economy?

An unimpressive economic performance highlights just how important the tumultuous politics with China has been in boosting her chances.

Minimum wage, investments and stocks have risen. But exports have fallen and average GDP growth in her first term - around 2.7% - is lower than that under her predecessor's first term, even though he had faced a global slowdown.

Average real monthly salary has increased slightly, but it's the same as 16 years ago due to inflation - and it's still the lowest among the four little Asian dragon economies.

Image copyright AFP Image caption Strained ties with the mainland have dearly cost the economy

Tourism, while up overall, is growing at a much slower pace compared to increases of 1 million visitors a year under Ms Tsai's predecessor. Bad relations with China cost Taiwan 1.5 million Chinese tourists and US$1.5bn in tourism earnings in 2018, compared to 2015.

Meanwhile, 40% of Taiwan's exports and most of its outward investments as well as expatriate workers still go to China, despite Ms Tsai's vows to reduce reliance on the mainland.

The island has also signed few free trade agreements and is left out of regional free-trade groups.

President Tsai has boosted social services, including childcare and elderly care, and built more public housing but she, being a wealthy landowner herself, has not tackled a key cause of high housing prices and the wealth gap - a tax system that fails to adequately tax property investors.

So what is at stake?

The election will decide the future of China-Taiwan relations, and could affect Washington-Beijing ties and regional peace.

Unifying with Taiwan is a long-term goal for China's leadership and it hasn't given up the use of force to do so.

Some people in Ms Tsai's party believe Beijing would have no choice but to talk to Tsai if she's re-elected, but China could instead step up pressure to prevent Taiwan from straying further.

Washington, especially under President Donald Trump and a Congress worried about China's growing competition and assertiveness, has been eager to support Ms Tsai, passing legislation to strengthen relations with Taiwan and selling it huge weapons packages.

But some analysts warn growing competition and confrontation between Beijing and Washington could turn Taiwan into a greater source of tension between the two superpowers.

Under Ms Tsai's first term, the US has already tried to strengthen its military ties with Taiwan, including it as a partner in Washington's Indo-Pacific strategy to balance China's influence in the region.

That leaves many worried Ms Tsai may be allying Taiwan too closely to the US, while forsaking its relations with its biggest trade partner and security threat - China.