The National Assembly, Pakistan’s parliament, has 272 contested seats and Mr. Khan’s party has done far better than all the others, winning 115 seats.

But 115 seats is still short of an outright majority. Mr. Khan has been holding meeting after meeting, and his party leaders have been furiously making long and ingratiating phone calls to charm another 20 or so politicians to join their side. In Pakistan there are many smaller parties and independents, holding around 50 assembly seats.

Moonis Elahi, a leader of another party, said that he had come to “an understanding” with Mr. Khan’s party and that he was trying to persuade other politicians to join as well.

On Saturday, Mr. Khan’s party sounded supremely confident.

“We already have the support of several winning candidates to form the federal government,’’ said Naeem-ul-Haq, a party official.

He said that all Mr. Khan was waiting for was Pakistan’s president to call the next session of the National Assembly, which should happen by mid-August.

The biggest loser in these elections has been the Pakistan Muslim League-Nawaz, the former governing party that saw its parliamentary power reduced to 64 seats. Its leader, Nawaz Sharif, a three-time prime minister, was thrown in jail less than two weeks before the election on corruption charges, damaging the party’s chances. Documents released through the Panama Papers leak helped build the case against Mr. Sharif.

But analysts say that many Pakistani politicians are corrupt and that the security services selectively targeted Mr. Sharif, his family and some of his allies because their leaders had found Mr. Sharif difficult to work with.