TAIPEI, Taiwan (AP) — Taiwan elected Tsai Ing-wen as its first female president Saturday, handing her pro-independence party its first majority in the national legislature and rejecting the China-friendly party that has led the self-governing island for eight years.

Voters concerned that Taiwan’s economy is under threat from China and broadly opposed to Beijing’s demands for political unification resoundingly chose Tsai over the Nationalists’ Eric Chu, a late replacement for his party’s original candidate, who was seen as alienating voters.

The result should be deeply unsettling to China, which may respond by further reducing Taipei’s already limited ability to win diplomatic allies and participate in international organizations.

In a statement issued after Tsai’s win, the Chinese Cabinet’s body for handling Taiwan affairs reaffirmed its opposition to Taiwan independence, but said it would work to maintain peace and stability between the two sides of the Taiwan Strait.

“Our will is as strong as a rock, our attitude unswerving on the principal matter of safeguarding national sovereignty and territorial integrity,” the Taiwan Affairs Office said.

Tsai said her victory was a further show of how ingrained democracy has become on Taiwan and showed that its people wish for a government “steadfast in protecting this nation’s sovereignty.” She too pledged to maintain the status quo with China. She said both sides have a responsibility to find a mutually acceptable means of interacting, while adding that Taiwan’s international space must be respected.

She said she would correct the policy mistakes of the past, but warned that: “The challenges that Taiwan faces will not disappear in one day.”

Chu resigned from his party’s leadership to take responsibility for the massive loss. In the final tally, Tsai won more than 56 percent of votes, while Chu had 31 percent and a third-party candidate trailing in the distance. Outgoing President Ma Ying-jeou is constitutionally barred from another term.

Making Tsai’s task easier, her Democratic Progressive Party won 68 seats in the 113-seat national legislature that has been traditionally dominated by the Nationalists, who took home 36, with the rest won by independents and smaller parties. Illustrating the extent of their defeat, the Nationalists had won 64 seats four years ago. The new legislature convenes next month while Tsai is set to be inaugurated in May.

The United States, Taiwan’s most important ally and source of defensive arms, congratulated Tsai on her victory.

“We share with the Taiwan people a profound interest in the continuation of cross-Strait peace and stability,” State Department spokesman John Kirby said in a written statement.

Tsai said one of her top priorities would be to unite Taiwan in order to gain strength and respect from international society. “Only when we grow stronger will we be able to gain respect and protect our people and our democratic way of life,” Tsai said, referring to Taiwan by its official name, the Republic of China.

Addressing a thin crowd of a few hundred supporters at his campaign headquarters, the Nationalists’ Chu said: “We failed. The Nationalist Party lost the elections. We didn’t work hard enough.” He followed his concession speech by making a long bow.

Reflecting unease over a slowdown in Taiwan’s once-mighty economy, undeclared voter Hsieh Lee-fung said providing opportunities to the next generation was the most important issue.

“Economic progress is related closely to our leadership, like land reform and housing prices. People aren’t making enough money to afford homes,” Hsieh said.

Tsai has proposed to open 200,000 units of affordable housing in eight years. Her party suggested in May that Taiwan’s laws change to raise wages and cut work weeks from 84 per two weeks to 40 in one.

Tsai also reaffirmed Taiwan’s sovereignty claim over East China Sea islands also claimed by China but controlled by Japan. She said Taiwan would also work to lower tensions in the South China Sea, where it, China and four other governments share overlapping territorial claims.

Tsai said she work to recruit talented people to her cabinet, increase the competitiveness of Taiwan’s export-oriented economy and safeguard the food supply following a series of scandals.

Her win will introduce new uncertainty in the complicated relationship between Taiwan and mainland China, which claims the island as its own territory and threatens to use force if it declares formal independence.

“Taiwan and China need to keep some distance,” said Willie Yao, a computer engineer voting in Taipei who said he backed Tsai. “The change of president would mean still letting Taiwanese make the decision.”

Tsai has refused to endorse the principle that Taiwan and China are parts of a single nation to be unified eventually. Beijing has made that its baseline for continuing negotiations that have produced a series of pacts on trade, transport and exchanges. Observers say China is likely to adopt a wait-and-see approach, but might use diplomatic and economic pressure if Tsai is seen as straying too far from its unification agenda.

Tsai supporters appeared confident that ties with China would weather a change in government.

“As long as Tsai doesn’t provoke the other side, it’s OK,” said former newspaper distribution agent Lenex Chang, who attended Tsai’s rally. “If mainland China democratizes someday, we could consider a tie-up,” he added.

Candidates from across the political spectrum sounded a rare note of unity Saturday after a teenage pop star posted a video online apologizing for having waved the Taiwanese flag on a South Korean TV program.

Sixteen-year-old Chou Tzu-yu, who performs under the name Tzuyu, had apparently been compelled to apologize after her South Korean management company suspended her activities in China for fear of offending nationalist sentiments on the mainland.

Ma, Tsai and Chu all condemned what they described as the bullying of a young girl.

“This particular incident will serve as a constant reminder to me about the importance of our country’s strength and unity,” Tsai told reporters.