Prime Minister Nawaz Sharif of Pakistan received a boost today when a joint sitting of parliament endorsed his leadership following two weeks of street demonstrations led by maverick politician Imran Khan.

Khan, who leads the Pakistan Tehreek-e-Insaf (PTI), has joined with Pakistani religious leader Tahir ul-Qadri to demand Sharif’s resignation for alleged vote rigging in the May 2013 elections that brought Sharif to power.

It is important that Sharif’s government survive—not for any reason having to do with him, his history, or his political agenda, but for the sake of democracy and stability in this particularly unstable part of the world. Pakistan’s transfer of power from one elected government to another last year was a milestone. It’s in the U.S. interest that it not be overturned by undemocratic means.

The protests have increased political instability and heightened civil–military tensions at a time when the army is battling terrorists who have sheltered in the tribal areas bordering Afghanistan and have conducted attacks throughout the nation, including a high-profile attack on the Karachi airport in June.

The parliament’s support for Sharif instilled confidence that he might weather the political storm despite allegations of a hidden army hand in the current political turmoil. Over the weekend, PTI president Javed Hashmi broke ranks with Khan, alleging that Khan was working in tandem with the Pakistan army to destabilize the government. While Hashmi had no proof for his allegations, they are not far-fetched for Pakistan, where the army often intervenes in politics. Indeed, Pakistani military leader Pervez Musharraf deposed Sharif during his previous stint as prime minister in 1999.

Sharif was re-elected in May 2013 in elections international monitors said were relatively free and fair with a surprisingly robust voter turnout—not a small feat for a country wracked by terrorism, sectarian violence, and a faltering economy. The elections also marked the first time in Pakistan’s history that one democratically elected government handed power to another elected government.

The political situation remains tense, and if violence breaks out on a large scale, the army would likely step in to restore order. While the army leadership may not be interested in taking direct control of the country, it seems likely that Khan received some encouragement from the military to move ahead with the protests. The army leadership seeks to maintain control of Pakistani policy toward India and Afghanistan and could be sending a signal to Sharif to back away from pursuing initiatives on these two fronts.

Khan is a volatile politician with strong anti-American views who has supported appeasement of Islamist extremists. While Sharif’s government has had a lackluster performance over the last year, the parliament’s support of his continued rule shows that Pakistanis respect the democratic process and are not fed up enough with the Sharif government to favor extra-constitutional means to overthrow it.