Mr. Sharif added, “We all have to work together to get the country out of a quagmire of problems.”

Mr. Khan was a giant in the cricket world before mounting his political movement. And throughout the campaign, he always kept a cricket bat close — as a totemic image on his posters and a prop in his campaign speeches. To the boisterous cheering of electrified young crowds, Mr. Khan would wave the bat and warn that he would use it to give the lion — the symbol of Mr. Sharif’s Pakistan Muslim League-Nawaz party — a heavy beating.

That captured the spirit of the campaign quite well.

Sharif and Khan supporters scuffled, berated one another on social media and dug up old scandals to spice their latest broadsides. Some political analysts faulted Mr. Khan as having allowed things to get too aggressive.

Mr. Sharif tried to appear above the fray during his campaign, but was given to writing off his main political rival publicly as having been a good athlete — and intimating that he had not become much more.

But on Tuesday, with Mr. Sharif well into the work of assembling a cabinet and governing coalition, the talk turned to finding common ground.