Pakistan's Supreme Court on Thursday ordered the release of former Prime Minister Imran Khan after terming his arrest unlawful.
The country's top court also directed Khan to appear before the Islamabad High Court (IHC) tomorrow, adding that he will have to abide by whatever decision the IHC gives.
Khan, who heads the Pakistan Tehreek-e-Insaf (PTI) party would spend the night in the same police guest house as before but allowed to meet a limited number of friends and family.
It was not immediately clear when he would be allowed to go home.
The latest orders were issued by a three-judge bench, headed by Chief Justice Umar Ata Bandial.
"The Supreme Court reversed all legal proceedings against Imran Khan ... he has been asked to present himself in the Islamabad High Court on Friday morning," lawyer Babar Awan told reporters.
Awan added that the court had ruled that Khan was now under its custody and not the anti-graft agency.
Imran Khan's detention on graft allegations has ignited deadly protests and a tussle with the country's powerful military.
A US immigration agent has shot and killed a 37-year-old woman in her car in Minneapolis on Wednesday during an immigration enforcement surge, according to local and federal officials, the latest violence in President Donald Trump's nationwide crackdown on migrants.
The US has seized two Venezuela-linked oil tankers in the Atlantic Ocean on Wednesday, one sailing under Russia's flag, as part of President Donald Trump's aggressive push to dictate oil flows in the Americas and force Venezuela's socialist government to become an ally.
US President Donald Trump said on Wednesday that the United States would withdraw from dozens of international and UN entities, including a key climate treaty and a body that promotes gender equality and women's empowerment, because they "operate contrary to US national interests."
The US seized a Russian-flagged oil tanker that was being shadowed by a Russian submarine on Wednesday, after pursuing it for more than two weeks across the Atlantic as part of Washington's efforts to block Venezuelan oil exports.
Electricity was restored to southwestern Berlin on Wednesday after a suspected arson attack on a power station by leftist activists caused a blackout for tens of thousands of households, the longest outage in the German capital since World War Two.