Pakistan heads to the polls on Thursday for an election that analysts say will be among the least credible in the country’s 76-year history, one that comes at a particularly turbulent moment for the nation.

For nearly half of Pakistan’s existence, the military has ruled directly. Even under civilian governments, military leaders have wielded enormous power, ushering in politicians they favored and pushing out those who stepped out of line.

This will be only the third democratic transition between civilian governments in Pakistan’s history. And it is the first national election since former Prime Minister Imran Khan was removed from power after a vote of no confidence in 2022. Mr. Khan’s ouster — which he accused the military of orchestrating, though the powerful generals deny it — set off a political crisis that has embroiled the nuclear-armed nation for the past two years.

The vote on Thursday is the culmination of an especially contentious campaign season, in which analysts say the military has sought to gut Mr. Khan’s widespread support and pave the way to victory for the party of his rival, former Prime Minister Nawaz Sharif.

Here’s what you need to know.

Over the past two years, Pakistanis have come out in droves to protest the behind-the-scenes role that they believe the military played in Mr. Khan’s ouster. The generals have responded in force, arresting Mr. Khan’s allies and supporters, and working to cripple his party ahead of the vote.

While the military has often meddled in elections to pave the way for its preferred candidates, analysts say this crackdown has been more visible and widespread than others.