ISLAMABAD, Pakistan — Imran Khan, Pakistan’s former prime minister, has been charged under the country’s anti-terrorism act, the latest chapter in a tense struggle for power with Pakistan’s current government since his ouster.

Sunday’s move came a day after Khan addressed a rally and criticized top police officials and a judge for the arrest of his chief of staff. Police said in a charge report that Khan had threatened the officials.

“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,” the report stated.

Since Khan was ousted from power in April, he has held boisterous rallies castigating the government. The former cricket star has maintained his strong political base and gained momentum in local elections. By contrast, Prime Minister Shehbaz Sharif, who replaced Khan, has made little progress in addressing the dire economic crisis that sent consumer prices skyrocketing.

Khan “will have to face the law for threatening and hurling abuses at the Magistrate and Police officers. Such acts of brazen thuggery are responsible for instigating extremism in society,” Interior Minister Rana Sanaullah tweeted early Monday.

Faisal Choudhary, one of Khan’s lawyers, told The Washington Post on Monday that his legal team requested the former prime minister be granted “pre-arrest bail,” an often temporary measure that would have kept Khan out of prison while his case moves through Pakistan’s judicial system.

The Islamabad high court instead granted him “transit bail” in its ruling Monday. The decision delays the arrest of the former prime minister as long as he appears at the counterterrorism court before Thursday.

Choudhary said the court’s decision provides “relief” to Pakistan’s former leader, while emphasizing that Khan “wants to appear before the court and face the charges against him.”

Hours after news of the charges broke on Monday, hundreds of Khan’s supporters gathered outside his residence in the capital of Islamabad in an effort to prevent his arrest. The crowds remained throughout the day Monday, cheering Khan when he waved to them after the court’s bail ruling.

“Imran Khan’s arrest is a ‘red line’ for us. If this line is crossed, that would lead to something very bad, not good for the people and for the country,” said Murad Saeed, a senior official in Khan’s Tehreek-e-Insaf party.

“We want to remain within the bounds of the constitution, but people are upset, very angry,” he said, warning that the popular unrest could “destroy” the sitting government.

Marriyum Aurangzeb, the minister of information, told a group of journalists Monday that “Imran Khan is coward and he has always run from the rule of law. He knows he has been involved in corruption so he won’t face the courts.”

Aurangzeb also accused Khan of trying to undermine the government in his bid for power: “Khan is attempting to create political unrest once again to harm the economy. He doesn’t want this country to progress.”

Friction between Khan and the Pakistani government intensified when Khan’s chief of staff, Shahbaz Gill, was arrested earlier this month. Gill made comments on a talk show that the government deemed “anti-military.” Khan alleges that Gill was tortured during his imprisonment, a claim the government denies.

Khan and his party are also faced with a partial media ban. Authorities have prohibited the live broadcast of Khan’s speeches, and the news channel that Gill made his remarks on was forced off air. Two news anchors associated with the same channel fled the country after reportedly being harassed by the government.

Khan was removed from office in April by a no-confidence vote in Parliament that took place after repeated delays.

He swept to power in 2018, promising to build a “new Pakistan” — an Islamic welfare state based on opportunity, justice and independence for the impoverished nation of 220 million people.

But he struggled to manage the economy amid rampant inflation and rising foreign debt. He also clashed with the country’s military leadership and lost political allies, who slowly gathered enough support to challenge him and accused him of bankrupting the country.

Khan is the first leader to be removed by a legally held vote since Pakistan was founded in 1947. Previous prime ministers have had their tenures cut short by military coups or other forms of extralegal interference.

Khan claimed his ouster was backed by the United States. He did not provide evidence for that claim, and the State Department has denied involvement.