Prime Minister Shinzo Abe's Liberal Democratic Party suffered a historic defeat in an election in the Japanese capital on Sunday, signalling trouble ahead for the premier who has suffered from slumping support because of a favouritism scandal.

On the surface, the Tokyo Metropolitan Assembly election was a referendum on Governor Yuriko Koike's year in office, but the dismal showing for Abe's party is also a stinging rebuke of his four and a half-year-old administration.

Koike's Tokyo Citizens First Party and its allies took 79 seats in the 127-seat assembly.

The LDP won a mere 23, its worst-ever results, compared with 57 before the election.

READ MORE: Lives in limbo - Why Japan accepts so few refugees

"We must recognise this as an historic defeat," former defence minister Shigeru Ishiba was quoted as saying by NHK - the national public broadcaster of Japan.

"Rather than a victory for Tokyo Citizens First, this is a defeat for the LDP," said Ishiba, who is widely seen as an Abe rival within the ruling party.

A bellwether for national trends?

Past Tokyo elections have been bellwethers for national trends. A 2009 Tokyo poll in which the LDP won just 38 seats was followed by its defeat in a general election that year, although this time no poll need be held until late 2018.

Koike, a media-savvy ex-defence minister and former LDP member, took office a year ago as the first female governor of the capital, defying the local LDP chapter to run and promising to reform the governance of a megacity with a population of 13.7 million and an economy bigger than the Netherlands'.

Her allies in the Komeito party - which is the LDP's national coalition partner - got 23 seats.

"I am excited but at the same time, I am also keenly aware of the weight of my responsibility," Koike told NHK, adding that the results had exceeded her expectations.

The strong showing by Koike's party will fuel speculation that she will make a bid for the nation's top job, although that may not be until after the 2020 Tokyo Olympics.

It could also widen cracks between the LDP and the Komeito while damaging prospects for the opposition Democratic Party, which won five seats.

The LDP's defeat could make it harder for Abe to pursue his cherished goal of revising the US-drafted constitution's pacifist Article 9 by 2020.

Abe's rivals in his party could be encouraged by the LDP's dismal performance to challenge him in a leadership race in September 2018.

Gaffes and scandals

Abe's troubles centre on concerns that he may have intervened to help Kake Gakuen (Kake Educational Institution) win approval for a veterinary school in a special economic zone. Its director, Kotaro Kake, is a friend of Abe's.

The government has not granted such an approval in decades due to a perceived glut of veterinarians. Abe and his aides have denied doing Kake any favours.

Potentially more devastating is the impression among many voters that Abe and his inner circle have grown arrogant.

READ MORE: North Korea threat boosts bomb shelter sales in Japan

"We must accept the results humbly," said Hakubun Shimomura, a close Abe ally and head of the LDP's Tokyo chapter. "The voters have handed down an extremely severe verdict."

Shimomura immediately stepped down from his role in the Tokyo chapter, taking responsibility for the crushing defeat.

Abe is expected to reshuffle his cabinet in the coming months in an effort to repair his damaged ratings, a step often taken by beleaguered leaders but one that can backfire if novice ministers become embroiled in scandals or commit gaffes.

Among those many political insiders expected to be replaced is Defence Minister Tomomi Inada.

Inada also came under harsh criticism after she implied in a speech last week that the Defence Ministry and the Japanese military were supporting the LDP. By law, the military is required to be politically neutral.