A Pakistani court has ordered former Prime Minister Imran Khan's release on bail for two weeks following an arrest that sparked deadly unrest in the country.
The order on Friday came after the Supreme Court ruled his arrest "invalid and unlawful".
"The court has given a two-week bail," Khan's lawyer, Faisal Chaudhry, told reporters.
Khan arrived amid tight security at the court in Islamabad on Friday as his supporters clashed with police elsewhere in the capital.
Nearly 2,000 people have been arrested for violence since Khan's detention on Tuesday and at least eight have been killed.
The Pakistan Tehreek-e-Insaaf (PTI) party, led by Khan, said thousands of "peaceful Pakistanis" would gather in Islamabad to show solidarity with their leader.
His arrest earlier this week, which sparked deadly unrest in the country, was declared null and illegal by the Supreme Court on Thursday.
The Supreme Court ordered him to appear before the Islamabad High Court to hear his petition against the anti-corruption action against him.
The violence resulting from Khan's arrest has increased instability in the country of 220 million people at a time of severe economic crisis, with high inflation, low growth and delays in IMF funding.
Protesters attacked military facilities, ransacked the home of a top army general in the eastern city of Lahore and set fire to government buildings and property elsewhere.
Khan was arrested a day after the military, which has great influence in the country, criticized Khan for accusing a high-ranking officer of plotting to kill him and blaming the former army chief for his ouster last year.
The army has warned Khan's supporters that it will respond firmly if there are more attacks on its properties. Meanwhile, Khan's party has said that it only called for peaceful protests.