Taiwan's prime minister has resigned after the ruling Nationalist Kuomintang (KMT) party suffered a landslide defeat at the island's biggest ever local elections.

Jiang Yi-huah announced that he had stepped down at a brief press conference, saying that he took "political responsibility" for the party's heavy losses in Saturday's elections. Unnofficial results showed the Nationalists lost in five out of Taiwan's six municipalities.

The heavy losses came as the ruling party struggles with growing fears over Chinese influence, a slowing economy and a string of food scandals.

The losses included its longtime strongholds of Taipei and Taichung.

The losses dealt a stronger than expected blow to President Ma Ying-jeou, who has staked his reputation on stronger ties with Beijing.

That will make it tougher for the Nationalists to hold onto the presidency in 2016 and jeopardises six years of landmark talks with China that have led to 21 agreements.

A record 11,130 seats were up for grabs in municipalities, counties, townships and villages. According to the Central Election Commission, the voter turnout was between 65 and 70 percent.

Much of the attention on Taiwan's biggest ever local elections had been focused on the Taipei mayoral race, which was won by an independent candidate backed by the opposition DPP.

Every Taiwan president was once the mayor of Taipei.

Independent candidate Ko Wen-Je won the race by positioning himself as a champion of social justice, while his defeated KMT rival Sean Lien had pledged to attract foreign investment and "internationalise" Taipei.

Ties between Taiwan and China have grown since President Ma Ying-jeou of the KMT came to power in 2008. China still regards the self-ruled island as part of its territory after it split in 1949 following a civil war.