Sudan's President Omar al Bashir has been ousted and arrested by the army, according to the country's defence minister.
Awad Mohamed Ahmed Ibn Auf said Mr Bashir - who seized power in a coup of his own in 1989 - had been detained "in a safe place" and that a military council would run the country for the next two years.
In a statement broadcast on state TV, he declared a state of emergency for three months and said "free and fair" elections would be held at the end of the 24-month transitional period.
He also announced a curfew for a month between 10pm and 4am and that Sudan airspace would be closed for 24 hours and all points of entry into the country until further notice.
Mr Bashir, 75, who had previously survived several armed rebellions, is believed to be under house arrest with several aides at the presidential palace, along with a number of Muslim Brotherhood leaders.
In January the autocratic leader had warned the "rats to go back to their holes" and said he would step down only for another army officer or at the ballot box.
"They said they want the army to take power. That's no problem. If someone comes in wearing khaki, we have no objection," he said at the time.
The move to topple him from power comes after months of anti-government protests against his 30-year rule, in anger over a struggling economy.
But the military action was immediately dismissed by some of those who had been calling for Mr Bashir's removal.
Organisers of a sit-in outside the defence ministry since the weekend had vowed to remain in the streets until "the regime steps down completely and power is handed to a civilian transitional government".
The Sudanese Professionals' Association, which has been spearheading the protests, rejected the defence minister's statement and called on protesters to maintain the sit-in and continue their rallies.
"We are not leaving. We urge the revolutionaries not to leave the sit-in," the association said, warning against attempts to "reproduce the old regime".
The mood among protesters who earlier celebrated Mr Bashir's expected departure had turned to anger, and many chanted, "Fall, again!"
Activist Alaa Salah, who had condemned him as a "tyrant" president on his way out, tweeted: "The people do not want a transitional military council.
"Change will not happen with Bashir's entire regime hoodwinking Sudanese civilians through a military coup.
"We want a civilian council to head the transition. #Sudan."
A photo of the 22-year-old architecture student dressed in white, out on the streets on Monday, has come to symbolise Sudan's protest movement.
She also tweeted she had received death threats since the image and a video of her went viral on social media, but added: "I will not bow down. My voice cannot be suppressed."
In the run-up to the live military broadcast, footage showed tanks and military armoured vehicles on the streets, while witnesses said soldiers had been deployed to key sites across the capital Khartoum.
Sudan's state security agency announced the release of all political prisoners across the country, but did not say when.
The news was followed by reports of protesters attacking the agency's offices in the eastern cities of Port Sudan and Kassala.
Sudan's state TV had announced early on Thursday morning that the military was preparing to make an "important" announcement.
Tens of thousands of jubilant Sudanese, including women carrying their children, were seen marching towards the military headquarters in Khartoum waving the national flag, singing and clapping in anticipation of the news that Mr Bashir had been removed from office.
Protesters outside the defence ministry chanted: "It has fallen, we won."
Twenty-two people have died since Saturday - 14 of them on Tuesday - after clashes between Sudanese security forces and demonstrators, according to activists behind the protests.
For the first time on Monday, leaders of the protests had called on the military to abandon the president.
They followed up on Tuesday by inviting the leaders to meet for discussions.
But their appeal was then rebuffed, with Major General Ahmed Khalifa al Shami saying the military had nothing to do with political matters.
It now appears that as the protests continued to escalate, the military had a rethink.
Saturday's marches in the capital marked the 34th anniversary of the overthrow of former president Jaafar al Nimeiri in a bloodless coup.
He was removed by the army after a popular uprising in 1985, which then handed over power to an elected government.
However, it only lasted a few years until Mr Bashir - then a career army officer - allied with Islamist hardliners and toppled it in a coup in 1989.
He is a pariah in many countries and is also wanted by the international war crimes tribunal for atrocities in Darfur.
His fall comes just over a week after similar protests in Algeria forced the resignation of the North African nation's long-ruling, military-backed president Abdelaziz Bouteflika.
The mass protests in Khartoum in recent months also bear striking resemblances to the popular uprisings in 2011 that swept across several Arab nations and ousted leaders in Tunisia, Libya, Egypt and Yemen.