By Asad Hashim and Kay Johnson
ISLAMABAD (Reuters) - Pakistani police raided an opposition party youth rally in the capital Islamabad on Thursday night and arrested about 40 people ahead of a planned protest that party leader Imran Khan has said would shut down the city, a party spokeswoman said.
The raid came hours after a city order banned all public gatherings ahead of Khan's planned protest set to begin on Nov. 2 in what he described as a final push to force Prime Minister Nawaz Sharif to resign over corruption allegations.
Khan has said it will defy the order, raising the stakes in a political standoff.
The arrests on Thursday night were at a youth meeting of Khan's Pakistan Tehreek-e-Insaf (PTI) party in a convention hall in Islamabad's E-11 district, spokeswoman Anila Khawaja said.
"All of a sudden police arrived and started arresting people," she said.
Video images on local Geo TV and on Dawn newspaper's website showed police in uniform beating activists with batons and leading those detained away to waiting buses.
A spokesman for the Islamabad district administration said the raid was enforcing the order issued earlier in the day by Deputy Commissioner Mushtaq Ahmed, the city's top administrator, outlawing gatherings of more than five people.
"For any convention, you need to seek permission from the district administration, even if it is indoors," said the spokesman, who said he could not be identified under protocol.
"They have done a convention without permission, which is against the law. So police have carried out an operation there," he said.
Khan vowed in a televised speech late on Thursday that he would risk arrest on Friday by defying the ban on public gatherings to attend a rally for a political ally, Sheikh Rashid of the Awami Muslim League.
"Then, whatever (the government) does, we will see," he said.
Khan, who led a weeks-long occupation that paralyzed much of Islamabad in 2014 after rejecting Sharif's runaway election win, has said the new protest would bring a million people to the streets.
He has said that sit-ins would force the closure of schools, public offices and the main international airport.
An Islamabad court on Thursday issued orders for both police and Khan's party not to block roads or public spaces during the planned protest.
At the center of Khan's latest challenge to Sharif's government are leaked documents from the Panama-based Mossack Fonseca law firm that appear to show that Sharif's daughter and two sons own offshore holding companies registered in the British Virgin Islands. Sharif's family denies wrongdoing.
Holding offshore companies is not illegal in Pakistan, but Khan has implied the money was gained by corruption.
Khan acknowledged in May that he used an offshore company to legally avoid paying British tax on a London property sale.
(Editing by Nick Macfie and Robin Pomeroy)