<br/> Pakistan Prime Minister Imran Khan won a crunch vote of confidence in parliament on Saturday after a surprise Senate election defeat last week precipitated the biggest political crisis of his premiership.<br/> <br/> The former cricket star won 178 votes against the 172 required after challenging his party to either back him or watch him return to opposition.<br/> <br/> Mr Khan, 68, won the vote easily after rival parties failed to attend the National Assembly session, but the Senate setback has energised his opponents just as a campaign to oust him appeared to have lost momentum.<br/> <br/> Supporters of the prime minister's Pakistan Tehreek-e-Insaf (PTI) ruling party meanwhile surrounded and attacked opposition leaders as they spoke to the press outside parliament. Mr Khan had demanded the vote of confidence last week after his recently appointed finance minister, Abdul Hafiz Sheikh, was defeated in the election to a Senate seat from Islamabad by the former president Yusuf Raza Gilani. Only the two senators from Islamabad are elected by parliament, while other 50 are elected by provincial assemblies. Mr Sheikh's defeat denied him the chance to enter parliament, which he needs to do to keep his post beyond six months.than<br/> <br/> A furious Mr Khan accused 15 or 16 of his party's 178 MPs of taking bribes from the opposition to vote for Mr Gilani, and demanded a public pledge of loyalty. The voting was by secret ballot so the rebels could not be traced.<br/> <br/> "This is your democratic right ... just raise your hands that you don't have confidence and I will go into the opposition [benches]," Mr Khan told supporters during a televised speech to the nation on Thursday.<br/> <br/> Yet when the vote came, he took no chances. Mr Khan wrote to party MPs that they risked being formally declared defectors if they voted against him, which would have cost them their seats, and the confidence vote was held by division. Officials told Bloomberg that Pakistan's spy agency was asked to monitor the movements of PTI lawmakers. <br/> Opposition parties boycotted the vote, saying the Senate defeat was enough to show that Mr Khan no longer enjoyed the confidence of the house, and the vote of confidence was unnecessary.<br/> <br/> Mr Khan's ploy of a confidence vote was praised as a master stroke by his supporters, but some commentators suggested it looked like a panic measure.<br/> <br/> "The electoral ouster of Khan's own finance minister has galvanised the opposition, and we can expect to see some energetic and well-attended anti-government rallies in the coming weeks," said Michael Kugelman, deputy director of the Asia Programme at the US-based Woodrow Wilson International Centre for Scholars.<br/> <br/> "And if Yousuf Raza Gilani manages to win the race to become chair of the Senate later this month, that will be another big blow to Khan." Mr Khan's had criticised electoral authorities for failing to hold a clean poll in the Senate election and he attacked them again after winning the confidence vote.<br/> <br/> "If this election was carried out well by you then who knows what is a bad election," he said.<br/> <br/> Mr Khan won power in 2018 after a crowd-pleasing campaign vowing to tackle the corruption of Pakistan's political elites. Leaders of the rival Pakistan Muslim League and Pakistan Peoples Party (PPP) have since faced corruption investigations that they allege are politically motivated.<br/> <br/> An alliance of opposition parties has threatened to mobilise a mass march on the capital later this month to force Mr Khan's resignation. Opposition leaders will be looking for any signs that the Senate upset translates into dwindling support from the powerful military, who have ruled Pakistan or pulled strings behind the scenes for much of the country's history.<br/> <br/> "The elephant in the room here is the army," said Mr Kugelman. "Khan and the security establishment have seen eye to eye throughout his time as premier, but the question will loom: If Khan finds himself under increasing pressure in the coming weeks, and if he grows more politically vulnerable, will the army conclude he's no longer its favourite son?"