Imran Khan, head of the opposition party Tehreek-e-Insaf (PTI), addresses a rally in Islamabad. He is vowing to step up protests unless Prime Minister Nawaz Sharif resigns. (Bilawal Arbab/European Pressphoto Agency)

Pakistan faced a brewing crisis Monday less than 18 months after completing a historic transfer of power from one democratically elected government to another, as a key opposition party said it is pulling out of the national assembly and thousands of demonstrators prepared for a showdown with security forces in the capital.

The decision by the Movement for Justice party, led by former cricket star Imran Khan, to withdraw from Parliament is testing the resolve of Prime Minister Nawaz Sharif as he attempts to fend off calls for his resignation.

Arguing that the national elections of May 2013 were fraudulent, Khan has mobilized several thousand followers to demonstrate in Islamabad in recent days. Khan, whose party finished third in those elections, has declared that the protest and other acts of civil disobedience will continue until the prime minister steps down.

The protests have prompted Sharif, who was ousted in a military coup in 1999 but returned as premier last year after his party’s first-place showing in the elections, to lock down parts of the capital.

Shipping containers have been stacked in the streets in a bid to keep protesters away from government buildings. More than 10,000 police and paramilitary officers — many of them relocated from Punjab province, where Sharif’s brother is chief minister — were also protecting the “Red Zone” that includes the Parliament, the Supreme Court and many foreign embassies.

Supporters listen to cleric and religious scholar Tahir ul-Qadri during a rally in Islamabad on Monday. (Akhtar Soomro/Reuters)

But in a speech to his supporters Monday night, Khan said he and his followers will test police lines Tuesday if Sharif remains in power.

“I will lead, and you will follow,” Khan said, adding that he hopes to reach the prime minister’s residence inside the security perimeter. “I am sure Pakistan police will not fire at me, or at you, but if they did, I would take the bullet in my chest.”

Khan spoke a few hours after other leaders of the Movement for Justice Party, also known as Pakistan Tehreek-e-Insaf (PTI), announced their resignation from the national assembly. The party holds just 34 of 342 assembly seats, and several politicians said Monday the body can still function until new elections are held.

Still, the move is one more headache for Sharif amid a flurry of threats to his government.

In addition to Khan, the firebrand cleric and religious scholar Muhammad Tahir ul-Qadri is also calling for Sharif’s resignation.

Qadri, who says Sharif’s economic and political reforms have been too timid, is also leading a multi-day mass demonstration in Islamabad, and he, too, has warned that several thousand of his supporters who are staging a sit-in Islamabad could expand their protests in the coming days.

The domestic turmoil comes as Pakistan’s military continues an offensive against the Pakistani Taliban and other militant groups in the country’s northwest. Sharif authorized the operation in June, and it has displaced more than 750,000 residents from North Waziristan. The United Nations and international aid groups have stressed that Pakistan’s government needs to remain stable to prevent the mass displacement from turning into a humanitarian disaster.

So far, military leaders have said little about the protests in Islamabad. But analysts say that the memory of the country’s three successful military coups hangs over the latest political discord.

Hasan Askari Rizvi, a Lahore-based defense and political analyst, said he fears the military could intervene if the protests become a distraction from the war effort.

“The military would try to resolve the crisis,” Rizvi said. “Their first choice would not be direct rule, but they could replace this government with another civilian government that would be backed by the military.”

Still, many Pakistani political leaders appear to believe that Khan, not Sharif, is at fault for pushing the country to the brink of crisis.

After ending his two-decade cricket career in 1992, Khan plunged into Pakistani politics, undertaking philanthropic work and founding his party. PTI mounted a spirited campaign ahead of last year’s national elections, which marked the first democratic transfer of power in Pakistan since its founding in 1947, but it ended up third in terms of seats won, trailing Sharif’s Pakistan Muslim League-N and the Pakistan People’s Party.

Khan immediately began contesting the results, alleging widespread fraud. Sharif has largely dismissed the allegations, but last week he asked a Supreme Court commission to investigate.

He has been adamant, however, that neither Khan nor Qadri will be allowed to destabilize the country.

“Nobody will be allowed to hold the state hostage,” he said in a televised speech last week.

Farhatullah Babar, a liberal Pakistani senator who previously served as former president Asif Ali Zardari’s press secretary, said Khan and Sharif’s government are both to blame for creating a “real threat to democracy.”

“They should have engaged Imran Khan in meaningful dialogue much earlier,” Babar said of the government. “Now there is a situation that is a very serious political crisis, and the balance of power may be shifting from Islamabad to Rawalpindi,” where the Pakistani army is based.