A South African court has issued an interim order stopping Sudan's leader Omar al-Bashir, who faces war crimes charges, from leaving the country.
The Pretoria High Court says Mr Bashir must stay until it rules on Monday on whether he should be handed over to the International Criminal Court (ICC).
President Bashir is in Johannesburg for an African Union (AU) summit.
He is accused of committing war crimes, crimes against humanity and genocide during the Darfur conflict.
About 400,000 people have died and more than two million have fled their homes since rebels took up arms in 2003, the UN says.
Government forces and allied Arab militias are accused of targeting black African civilians in the fight against the rebels.
President Bashir was welcomed by South African officials as he arrived in Johannesburg. After the court announced it would rule on a request to arrest him, he posed for a group photo with other African leaders.
The High Court initially said it would issue its ruling on Sunday. But it later postponed the hearing until Monday, when the summit is due to end.
There are tensions between the ICC and the AU, with some on the continent accusing the court of unfairly targeting Africans.
The warrants against Mr Bashir, who denies the allegations, have restricted his overseas travel. He has, however, visited friendly states in Africa and the Middle East.
Analysis: Andrew Harding, BBC Africa correspondent
South Africa has often shied away from this sort of diplomatic headache, but this time the government has stepped straight, and deliberately, into controversy, courting Western fury by rolling out the welcome carpet for President Bashir.
The South African government must, surely, have foreseen the possibility of a legal challenge. If President Bashir is allowed to return home unimpeded, South Africa's actions will be bitterly condemned internationally - if less loudly within the continent - as a blow against the credibility of the ICC.
And if Sudan's president is detained, or perhaps even arrested, then Pretoria will be accused of luring a fellow African leader into a trap. Some would call that a no-win situation.
But it's clear that South Africa's government has chosen to flaunt its growing antipathy towards "Western" rules, and towards a court in which so many African leaders now appear to have lost faith.
The ICC relies on member states to carry out arrests.
However correspondents have said the South African government - a signatory to the treaty establishing the ICC - is unlikely to move against the Sudanese leader.
South Africa's governing ANC said immunity had been granted to "all (summit) participants as part of the international norms for countries hosting such gathering of the AU or even the United Nations".
The ANC also said the ICC was "no longer useful for the purposes for which it was intended".
The court, which sits in The Hague, was set up in 2002 to try cases of genocide, crimes against humanity and war crimes, when national courts cannot handle them.
The official theme of the Johannesburg summit, chaired by Zimbabwean President Robert Mugabe, is women's empowerment and development.
But the political turmoil in Burundi, crisis in South Sudan and recent xenophobic attacks in South Africa were also likely to feature heavily.