Pakistan's Nawaz Sharif has made a triumphant election comeback and looks set to form a stable government.

Mr Sharif, who was toppled in a 1999 military coup, jailed and exiled, may not win enough seats to rule on his own but has built up enough momentum to avoid having to form a coalition.

Before the election it was thought that he would have to form a coalition with his main rivals, former cricketer Imran Khan's Tehrik-i-Insaf (PTI) and the Pakistan People's Party (PPP).

The steel magnate held off a challenge from Mr Khan, who had hoped to break decades of dominance by Sharif's Pakistan Muslim League (PML-N) and the PPP, led by the Bhutto family.

The two parties have formed governments whenever the military, the most powerful force in the nuclear-armed nation, has allowed civilian rule.

Mr Khan put up a strong fight and he is likely to remain a force in politics, possibly becoming the main opposition figure.

The PPP, which led the government for the last five years, has done badly and could come in third place.

Sharif's PML-N had captured 88 of the 272 contested National Assembly seats.

Based on trends, it was likely to get around 130, and should easily be able to make up the required majority of 137 with support from independents and small parties.

The PTI has secured 34 seats while the PPP for the past five years, won 32.

Once it established a majority, Mr Sharif's party will be allocated a majority of 70 other parliamentary seats that are reserved for women and non-Muslim minorities.

Mr Sharif advocates free-market economics, and is expected to pursue privatisation and deregulation to revive flagging growth.

He has said Pakistan should stand on its own two feet but may need to seek a another bailout from the International Monetary Fund to avoid a balance of payments crisis.

The PML-N leader has said he could do business with the IMF.

Mr Sharif will likely press for negotiation with the Pakistan wing of the Taliban.

The Taliban have carried out bombing attacks which failed to derail the election.