Sudan's announcement that it plans to hand ousted long-serving President Omar al-Bashir over to the International Criminal Court (ICC) was dramatic and surprising, but it also takes the country into uncharted waters, writes Sudan expert Alex de Waal.
The decision to get the ICC involved was welcomed by the majority of Sudanese who long for justice.
After all, one of the central demands of the protesters who helped bring an end to President Bashir's 30-year dictatorship was that he should be accountable for his alleged crimes.
It should also be seen, alongside other diplomatic moves, as an attempt by Sudan to normalise relations with the West and ditch its pariah nation status.
But the process will be fraught with difficulties and the extent and timing of bringing past leaders to account is a matter of delicate political judgement.
It also depends on the readiness of the ICC itself.
The priority of the government, an uneasy cohabitation of civilians and generals, is to keep the fragile transition to democracy on track, and there is concern that army commanders could be antagonised by getting the ICC involved.
Bashir is already serving a two-year sentence for corruption but he is wanted by the international court for crimes relating to mass atrocities in the country's Darfur region from 2003 to 2008.
He is also under investigation for violating the democratic constitution by mounting a military coup in 1989.
Shortly after his overthrow in April last year, Bashir was arrested and taken to the colonial-era Kober prison, which is where he sent hundreds of parliamentarians, trade unionists, journalists and other opposition figures over the years.
But whether Bashir will be sent to the court in The Hague, or if he will be tried in a judicial process that may have ICC involvement in Sudan itself is still not clear.
2003 conflict begins as two rebel groups challenge government
2004army moves to quell rebel uprising
2004 pro-government militia accused of systematic killings
2005 UN inquiry says no genocide policy but case should go to ICC
2009ICC issues warrant for Bashir for crimes against humanity
2010ICC second warrant adds genocide charges
Lt Gen Abdel Fattah al-Burhan, the head of the sovereign council, which has replaced the presidency for now, told rights group Human Rights Watch that "no-one is above the law".
"People will be brought to justice, be it in Sudan or outside Sudan, with the help of the ICC," he is quoted as saying. "We will cooperate fully with the ICC."
There is also still a lot to be sorted out on the part of the ICC.
Bashir rejected foreign court
At the height of the war in Darfur, in March 2005, the UN Security Council referred the case to the court in resolution 1593.
The prosecutor's office began its investigations at once - though they never travelled to Sudan itself.
Two years later they announced arrest warrants against a militia leader, Ali Kushayb, and the co-ordinator of the Darfur campaign, government minister Ahmed Haroun.
Bashir vowed he would never hand over a Sudanese to a foreign court.
The ICC prosecutor at the time, Luis Moreno-Ocampo, set his sights higher. In July 2008 he announced he was seeking an arrest warrant for the president himself, on 10 counts of war crimes, crimes against humanity and genocide.
Eight months later the judges of the ICC issued the arrest warrant, dropping the genocide charges as they did not consider the case strong enough.
But after the prosecutor appealed, the judges reversed their decision.
Students of international criminal law should look carefully into the judges' reasoning, because the question of the standard of proof for a genocide charge will loom high if Bashir is transferred for trial in The Hague.
Allegedly committed in Darfur 2003-2008
Genocidethree counts including targeting groups for destruction
Murder and tortureamong the five counts of crimes against humanity
War crimestwo counts including intentionally targeting civilians
The arrest warrant was controversial. Bashir responded by expelling 13 foreign relief agencies and abandoned any discussion of stepping down before the 2010 elections.
Fearing that any successor would hand him over to the ICC, he concluded that he would ensure his safety by staying put in Khartoum's Republican Palace.
He may now be proved correct, but his exact fate is still not certain.
Many of the soldiers in the current government served in military campaigns that witnessed egregious violations of human rights, notably in Darfur but also elsewhere in the country.
Prominent among these is Gen Mohamed Hamdan "Hemeti" Dagolo, leader of the Rapid Support Forces (RSF).
Although not personally named in investigations into those responsible for atrocities during the height of the war in Darfur, Hemeti was a brigade commander of the Janjaweed, closely associated with mass killing, displacement and rape.
Additionally, seven weeks after Bashir's overthrow, armed men from the RSF unleashed a violent attack on civilian protesters in the capital Khartoum, killing at least 87 people.
There may be some concern about who else could face the law, but the authorities in Sudan have other issues influencing their decisions.
The most immediate is the peace talks between the government and the armed opposition in Darfur. The opposition has been adamant that the ICC arrest warrants should be served, and agreeing to that demand is an important step towards peace.
A second element is that the Sudanese government is desperate for the US to lift its designation as a state sponsor of terror.
This goes back to the 1990s, when Sudan hosted Osama Bin Laden, and al-Qaeda operatives mounted terror attacks on American embassies in Kenya and Tanzania in 1998.
Sudan was also blamed for having a role in the deaths of 17 US sailors when the USS Cole was bombed by al-Qaeda in a port in Yemen in 2000 - on Thursday, Sudan agreed to pay compensation to the families of the dead officers.
The country is cornered. Unless its terrorist designation is lifted it cannot expect debt relief or economic stabilisation.
Last week's unexpected meeting in Uganda between Gen Burhan and Israel's Prime Minister Benjamin Netanyahu should also be seen in the light of desperate efforts to garner anti-terror credentials.
Handing Bashir to the ICC would also be a step to get advocates for human rights and democracy in Sudan onside. Some of these advocates, such as Hollywood actor George Clooney, have been conspicuously lukewarm in supporting the Sudanese revolution.
ICC prosecutor 'overreached'
They would welcome the extradition of Bashir to the ICC. But they should also be careful what they wish for. The arrival of the former Sudanese president in The Hague will present a formidable challenge to the prosecutor.
When Mr Ocampo presented his case for an arrest warrant against Bashir 12 years ago, he overreached.
He described the president as a supreme dictator, commanding every instrument of state policy, who had carefully nurtured a genocidal plan against Darfur's black African tribes over the decades.
That claim simply does not stand up: the atrocities were mainly the result of a panicked overreaction to an insurgent threat, carried to a brutal extreme.
Mr Ocampo also alleged a two-stage plan: massacres and displacement followed by systematic annihilation in the camps.
Conditions in Darfur's camps were deplorable, but to compare them to the Warsaw Ghetto, where Jewish people were contained, before being sent to their deaths in the Holocaust was, in the words of one humanitarian leader at the time, "insane".
The people of Darfur were, at that point, recipients of the world's largest humanitarian operation. At the time, some Sudanese wryly commented that Mr Ocampo had charged Bashir with the only crime he had not actually committed.
If Bashir is extradited to The Hague, the first step will be a confirmation of charges hearing.
The current prosecutor, Fatou Bensouda, will need substantially to improve on her predecessor's performance if the charges, especially on genocide, are to go forward.
The ICC has suffered recent cases in which defendants were acquitted.
It cannot afford another high-profile failure. And a few years ago it put its Darfur investigations on ice, expecting no progress.
The ICC just is not ready for Bashir yet.
Given this, and despite the public excitement, it is likely that the prosecutor at the ICC and the Sudanese authorities will realise that they have a common interest in moving ahead slowly.
Alex de Waal is the executive director of the World Peace Foundation at the Fletcher School of Law and Diplomacy at Tufts University.