Sharif, 67, had to step down as the chief of the Pakistan Muslim League-Nawaz (PML-N) after he was disqualified as the prime minister by the Supreme Court on July 28 in the Panama Papers scandal.
Addressing a gathering of party members at the Convention Centre here, Sharif said his supporters kept reelecting him to power despite his ousters from the office.
He said the party members knew the reasons behind his disqualification as prime minister.
Under The Representation of Peoples Act 1976, a disqualified person could not hold office of a party.
More From This Section
The law was passed to allow the party to re-elect Sharif as its head, on the eve of a party convention called for the express purpose of electing Sharif to the post.
Sharif in his address to his supporters, thanked the people for repealing the law which barred disqualified politicians from holding office in a party.
"I would like to thank the people for throwing this law back at their faces," he said.
Sharif said he had been disqualified for "not receiving salary from his son", but the violation of the Constitution by four dictators during the country's history was declared legal.
"When no justification was found for their unconstitutional steps, the Doctrine of Necessity was invented," he said, adding that he wishes a doctrine of necessity was also created for respect of people's mandate and democracy.
"I am warning you today, if we do not try to change the situation, Pakistan will not forgive us."
"The people will decide through their vote [in general elections of 2018] who is qualified and who is unqualified," he said.
Prime Minister Shahid Khaqan Abbasi termed Sharif's return as party president a "historic day".
The premier said he is proud to be among the few people who witnessed the moment Sharif took his place as the party chairman for the first time.
Earlier, PML-N leader Dr Tariq Fazal Chaudhry submitted Sharif's papers for party president in the Election Commission of Pakistan (ECP) while no one other candidate from the party contested the election.
The election of party president is a requirement by Election Commission of Pakistan that already last month issued notice to PML-N for failing to choose permanent successor of Sharif.
Sharifs election has temporarily healed the rifts within the party which appeared on the verge of defections after his ouster.
But Sharifs fate as party president still hangs in balance as Pakistan Awami Tehreek party has challenged the new law in the Lahore High Court, while Pakistan Tehreek-e-Insaf and other parties have announced to challenge it in the Supreme Court.