The Pakistan Muslim League, allied to President Pervez Musharraf, has conceded defeat in Pakistan's parliamentary elections.
The move leaves the party of former premier Benazir Bhutto and other opponents in line for a win.
The political survival of Mr Musharraf was placed in serious doubt as unofficial results on state television showed an overthrow of the ruling party.
A spokesman for the PML-Q said it accepted the verdict of the nation and officially conceded defeat.
Nawaz Sharif said he wanted to work with other opposition parties in parliament to rid Pakistan of dictatorship forever.
Mr Sharif, whom Musharraf ousted in a coup in 1999 said that he had already spoken to Ms Bhutto's widower, Asif Ali Zardari, and would meet him on Thursday in Islamabad for further talks.
With votes counted in 257 constituencies, the PML-Q and its allies had taken a total of 57 seats.
The party's chief and several key members lost their seats in Pakistan's national assembly.
Even if the PML-Q won all the remaining seats not yet counted, it would not be able to attain a majority in the parliament, which has 272 elected and 70 unelected seats.
US Senator John Kerry, in Pakistan as part of a team to observe the elections, said the vote meets the basic threshold of credibility and legitimacy. The opposition had feared polls would be rigged.
State television said Bhutto's Pakistan People's Party had 85 seats, Mr Sharif's faction of the Pakistan Muslim League had 65 seats, with the PML-Q, smaller parties and independents taking the rest, according to preliminary unofficial results.
Click here for more on the Pakistan elections