ISLAMABAD - Pakistan’s former prime minister Imran Khan has been charged under the country’s anti-terrorism laws for allegedly threatening police and a judge, according to local media reports.

The charges filed on Sunday relate to a speech made by Mr Khan a day earlier in capital Islamabad in which he slammed the police for the alleged torture of his aide Shahbaz Gill following his arrest on sedition charges.

The speech blamed Islamabad’s police chief and a female judge on the detention and alleged mistreatment of Mr Gill.

“You should also get ready as we will take action against you,” Mr Khan announced to the crowd, referring to the pair directly.

The former international cricketer also accused the government of blocking YouTube in the country to deny live access to his speech.

“Imported government blocked YouTube midway through my speech,” Mr Khan tweeted.

While the Pakistan Telecommunication Authority has not responded to Mr Khan’s accusation, the Islamabad police has denied allegations of custodial torture of Mr Gill.

It has in turn accused Mr Khan of breaking the country’s anti-terrorism law because his “threats” have led to “fear and terror among the police”.

“The way Imran Khan made his speech and the threats he made led to fear and terror among the police, judiciary and the common people and it harmed the peace of country,” police said in its charges, according to The Washington Post.

Hundreds of the former prime minister’s supporters gathered outside his home in Islamabad after news of the investigation broke, vowing to “take over” the capital if police tried to detain him.

The police, who were present at the scene, had to clarify they were not there to arrest the former leader but to maintain law and order.

Mr Khan is continuing his aggressive campaign against the Shehbaz Sharif government accusing it of stealing the premiership with the help of foreign support.

The former prime minister has raised concerns over censorship of his speeches in the past.

He earlier said the government was “banning live coverage” of his speeches and events, many of which he claimed have had massive turnouts.

“This is not only a gross violation of freedom of speech but also negatively affects the digital media industry and the livelihoods of many,” Mr Khan tweeted in reference to the ban.

Mr Khan was ousted in a historic no-confidence motion in April this year. He has since intensified attacks on the succesive government in recent months.

The country is expected to hold an election early next year.