ISLAMABAD—Pakistan was plunged into a new phase of political turmoil Friday after the country’s Supreme Court removed Prime Minister Nawaz Sharif from office following an investigation into allegations of corruption.

Pakistan, a fragile democracy that has been ruled by the military for nearly half its existence, is considered vital to the U.S. effort to bring peace to neighboring Afghanistan. Now Islamabad’s attention to that problem could be sapped by its own political crisis. The world’s sixth-most populous country, Pakistan...