Celebrations on the streets of Lahore as Nawaz Sharif appears to have made a comeback and now looks set for a third term as prime minister.
Toppled in a coup, jailed and later exiled, Sharif appears to have held off a challenge from former cricket star Imran Khan.
As the 63-year old addressed supporters he declared victory.
(SOUNDBITE) (Urdu) FORMER PAKISTANI PRIME MINISTER NAWAZ SHARIF SAYING:
"The results are coming in, and all of us know that it has been confirmed that, God willing, the Muslim League is emerging as the biggest party. Please pray that by the morning the results are so good that we can form a government without having to rely on crutches."
The elections were a landmark, marking the first time an elected government will replace another.
The next government will have to contend with a Taliban militancy, endemic corruption, chronic power cuts and crumbling infrastructure in the nuclear-armed country.