Pakistan's President Pervez Musharraf has declared emergency rule and suspended the country's constitution.
He defended his actions in a national address, saying he was curbing a rise in extremism in Pakistan.
Chief Justice Iftikhar Chaudhry has been replaced and the Supreme Court surrounded by troops, who also entered state-run TV and radio stations.
The moves come as the Supreme Court was due to rule on the legality of Gen Musharraf's October election victory.
The court was to decide whether Gen Musharraf was eligible to run for re-election last month while remaining army chief.
The BBC's Barbara Plett reports from Islamabad that fears had been growing in the government that the Supreme Court ruling could go against Gen Musharraf.
Former Prime Minister Benazir Bhutto, who recently returned to the country after years of self-exile to lead her party in planned parliamentary elections, was in Dubai on a personal visit when news of the declaration broke.
However, she immediately flew back to Karachi where she condemned Gen Musharraf's decision.
It is not clear whether the parliamentary elections due in January will go ahead. Gen Musharraf made no mention of them in his speech, but he insisted he wanted to restore democracy.
Suicide warning
Pakistan has been engulfed in political upheaval in recent months, and the security forces have suffered a series of blows from pro-Taleban militants opposed to Gen Musharraf's support for the US-led "war on terror".
In a lengthy televised speech late on Saturday, Mr Musharraf said the situation had forced him into making "some very painful decisions".
"I suspect that Pakistan's sovereignty is in danger unless timely action is taken," he said.
He insisted his decisions were made for the benefit of Pakistan.
"Extremists are roaming around freely in the country, and they are not scared of law-enforcement agencies," the president said.
As well as defending emergency rule to the Pakistani people, Gen Musharraf also appealed directly to his Western allies for patience.
"Kindly understand the criticality of the situation in Pakistan and around Pakistan. Pakistan is on the verge of destabilisation," he said.
"Inaction at this moment is suicide for Pakistan and I cannot allow this country to commit suicide."
US Secretary of State Condoleezza Rice said the declaration of emergency rule was "highly regrettable" and called upon Pakistan to have free and fair elections.
UK Foreign Secretary David Miliband also expressed concern, saying it was vital Pakistan's government "abides by the commitment to hold free and fair elections on schedule".
New chief justice
Gen Musharraf's address echoed the text of the declaration of emergency rule, which opens with a reference to the "grave threat" posed by the "visible ascendancy in the activities of extremists and incidents of terrorist attacks".
It ends by saying that the constitution is in "abeyance" - which, according to our correspondent, in effect means that martial law has been imposed, although there is not a heavy security presence on the streets.
The political and judicial core of Islamabad has been shut down, but the rest of the city is functioning normally, our correspondent says.
She says it is clear from reading the emergency proclamation the main target is the judiciary which is accused of interfering in government policy and weakening the struggle against terrorism.
Chief Justice Chaudhry and eight other judges refused to endorse the emergency order, declaring it unconstitutional, resulting in Mr Chaudhry's dismissal.
A new chief justice has been appointed, officials say. He is Supreme Court judge Abdul Hameed Dogar, a supporter of Gen Musharraf who was a member of the special tribunal appointed to investigate allegations of wrongdoing by Mr Chaudhry.
Ms Bhutto's return from self-imposed exile last month came about with the co-operation of Gen Musharraf.
Our correspondent says that in the changed circumstances she will have to decide whether she is returning to lead the opposition against the president, or should wait on the sidelines in the hopes of securing an agreement with him.