Pakistan's ruling party and the opposition have selected a former chief justice as the country's caretaker prime minister for an interim two-month period.

Incumbent Prime Minister Shahid Khaqan Abbasi, whose term ends this week, and opposition leader Khursheed Shah announced that Nasir-ul-Mulk has been appointed caretaker prime minister pending the outcome of parliamentary elections on July 25.

Whoever wins majority in parliament in that vote will name the next prime minister.

Mulk will likely be sworn in on Friday, June 1. The government of Pakistan Muslim League formally ends May 31 when the nation's parliament will be dissolved ahead of the balloting.

It's only the third time in Pakistan's 70-year-long history that a parliament has finished its five-year term without political upheaval or dismissal by the military.